ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 26th, 2003, 02:40 PM
utmostrusselb utmostrusselb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Canada
Posts: 40 utmostrusselb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Updating a Large SQL Query

HI, I am updating over 100 fields in 7 tables with SQL in VB 6.0. The values will mostly come from check boxes. Do I need a VB variable to hold each value for my SQL query?

Also, what is the syntax for skipping an optional field? Do I just skip it and use comma's? I will never know which values are checked off so I cannot write code that will only insert my true values.
__________________
Best regards,
Russ Bergen
Senior Software Developer and Webmaster

Reply With Quote
  #2  
Old July 26th, 2003, 06:04 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
If you are updating data you only need to specify the fileds that will be updated.
Update table
set field1 = x,
field3 = y
...
Your first question will depend on what you are updating. Is this a timestamp or do each of the check boxes hold distinct values? Are the values derived?

Reply With Quote
  #3  
Old July 26th, 2003, 06:30 PM
utmostrusselb utmostrusselb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Canada
Posts: 40 utmostrusselb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Most of the values are boolean values: True or false. There are 100+ check boxes. When a check box is not checked, the value is false. I do not need to update the table if the value is false. If the check box is true, I need to enter "True" into that field. Therefore, I can have an unlimited number of variations with different check boxes checked for each new record.

With that in mind, you see that I cannot dynamically create an SQL query. I must have each field named in the Update part of the query. When I input the data, I want to skip most fields. Do I just use a , , , when I skip fields? Do I need a variable for each True value?

Reply With Quote
  #4  
Old July 26th, 2003, 10:53 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
You can dynamically generate the SQL. If you are having to assign the boolean values, you already have knowledge of what columns and what tables will be updated. You could just create a matrix like if then else block.

Reply With Quote
  #5  
Old July 26th, 2003, 11:43 PM
utmostrusselb utmostrusselb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Canada
Posts: 40 utmostrusselb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I thought about that but there are too many variables to do this. There are 100 variables. How would I get the placeholders to work? For instance if field 20, 40 and 60 are true and nothing else, how would I make an update? I only need to enter in true for those fields and the rest I can skip since they are not required. Can you show me some code?

Reply With Quote
  #6  
Old July 27th, 2003, 09:59 AM
nopoints nopoints is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Windsor ON, Canada
Posts: 459 nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 44 m 22 sec
Reputation Power: 8
specify the field the control displays in the control's tag. then iterate through the controls adding that field to the list and that control's value as well.
__________________
Programmer's Corner

Reply With Quote
  #7  
Old July 27th, 2003, 10:19 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
I think this is disabled in aspx, but in plain asp you can name fields just "1" or "2" and so on. I've done it before where you set the default to false, and then you do a for loop, and build the sql statement that way where if ischecked = true or however else you have the form set up, you just set that corresponding database variable = true.

I know i've done it where i have divs 1-5 for example. And a drop down menu was there and if they selected 4.
i think it was this.....

<body onload=set_all_display_to_none()>
for (i=0;i<dropmenu.value;i++)
document.getElementByID(i).display="inline"

try and apply that and see if it works.....

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Updating a Large SQL Query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway