469,579 Members | 1,064 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

Two insert queries, second one prints first ones data and doesn't work.

I am writing an import function with asp, and excel that writes imported excel sheets to to several SQL tables and everything works fine until it reaches the "add data for search" section or query 2. Since I was having issues I decided to write out the query2 results using response.write (query2) to see what I was dealing with and found that the first query is for some reason being added to the end of query2 and this is what is causing the insert not to execute. The problem is that I cannot figure out why.

Below you can find both inserts and the results I spoke of enclosed in the output block. The extra content from the 1st insert block starts at "use" and is bolded.

Any help would be awsome as I am super stuck. Thanks ahead of time.

Chris

Expand|Select|Wrap|Line Numbers
  1. 'add data to xtras for the footnotes
  2. 'added by chris
  3. query="SELECT idProduct FROM products WHERE sku='" &psku
  4.     set rstemp=conntemp.execute(query)
  5.     xproductid = rstemp("idProduct")
  6. query="INSERT INTO xtras (product_id,footnotes,fitment) values ('" & xproductid & "','" & pfootnotes & "','" & pfitment & "')" 
  7.     query=replace(query,chr(34),""")
  8.     query=replace(query,"**DD**",chr(34))
  9.     set rstemp=conntemp.execute(query)
  10.  
  11.  
  12. 'add data for the search
  13. 'added by chris            
  14. query2="INSERT INTO vehicle_rel (product_id,type_product,start_year,end_year,drive,fuel,vehicle_model1,vehicle_model2,vehicle_model3,vehicle_model4,vehicle_model5,vehicle_model6,vehicle_model7,vehicle_model8,motor1,motor2,motor3,motor4,motor5,motor6,motor7,motor8,diameter,width,rim_size,lug_pattern,backspacing,finish) values (" & xproductid & ",'" & ptypep & "'," & pstartyear & "," & pendyear & ",'" & pdrive & "','" & pfuel & "','" & pvmodel1 & "','" & pvmodel2 & "','" & pvmodel3 & "','" & pvmodel4 & "','" & pvmodel5 & "','" & pvmodel6 & "','" & pvmodel7 & "','" & pvmodel8 & "','" & pmotor1 & "','" & pmotor2 & "','" & pmotor3 & "','" & pmotor4 & "','" & pmotor5 & "','" & pmotor6 & "','" & pmotor7 & "','" & pmotor8 & "','" & pdiam & "','" & pwidth & "','" & prsize & "','" & pbspacing & "','" & pfinish & "')" 
  15.                 response.write (query2)
  16.     query2=replace(query,chr(34),""")
  17.                 query2=replace(query,"**DD**",chr(34))
  18.     set rstemp=conntemp.execute(query2)
  19.  
Result of
Expand|Select|Wrap|Line Numbers
  1. response.write (query2) 
is:

[output]
INSERT INTO vehicle_rel (product_id,type_product,start_year,end_year,drive ,fuel,vehicle_model1,vehicle_model2,vehicle_model3 ,vehicle_model4,vehicle_model5,vehicle_model6,vehi cle_model7,vehicle_model8,motor1,motor2,motor3,mot or4,motor5,motor6,motor7,motor8,diameter,width,rim _size,lug_pattern,backspacing,finish) values (723,'Suspension Lift',2000,2005,'4WD','Gas','K1500','','','','','' ,'','','','','','','','','','','Use 315/75R15 Tires w/15x10 Wheels w/4 5/8" BS w/Minor Trimming
Use 315/70R17 Tires w/17x9 Wheels w/4 5/8" BS w/Minor Trimming
Use 325/65R18 Tires w/18x9 Wheels w/5" BS w/Minor Trimming','Early 2000 models may requires 1999 box kits. If factory transmission crossmember is straight use 2000-2005 applications. If factory Transmission Crossmember is curved in an S shape use 1999 applications.
Will not fit vehicles with Quadrasteer.
Will not fit vehicles with Auto Ride shocks.
If vehicle is equipped with factory 17" wheels must use 17" or larger aftermarket wheels.
On 2005 and up GMC models use 33/12.50R17 tire w/ 17x8 wheels with 4 5/8 BS with minor trimming.','Use 315/75R15 Tires w/15x10 Wheels w/4 5/8" BS w/Minor Trimming
Use 315/70R17 Tires w/17x9 Wheels w/4 5/8" BS w/Minor Trimming
Use 325/65R18 Tires w/18x9 Wheels w/5" BS w/Minor Trimming','',''
)
[/output]
Oct 13 '07 #1
2 1524
Figured out the double query issue, was a stupid cut and paste mistake! In the file that reads the excel sheet now it will not write the second query to vehicle_rel.

Thanks,

Chris
Oct 13 '07 #2
jhardman
3,406 Expert 2GB
Figured out the double query issue, was a stupid cut and paste mistake! In the file that reads the excel sheet now it will not write the second query to vehicle_rel.

Thanks,

Chris
glad you got it figured out. are you saying you have another question?

Jared
Oct 18 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

16 posts views Thread by Philip Boonzaaier | last post: by
10 posts views Thread by Stéphane Cazeaux | last post: by
9 posts views Thread by Dom Boyce | last post: by
9 posts views Thread by David Eades | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.