p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old June 16th, 2005, 04:58 PM
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here it is:

<p align="center"><span class="text">Additional Locations:
<select name="locations" size="3" multiple id="locations">
         <option value="001">001</option>
         <option value="002">002</option>
         <option value="003">003</option>
         <option value="004">004</option>
         <option value="005">005</option>
</select>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #12 (permalink)  
Old June 16th, 2005, 05:06 PM
Imar's Avatar
Wrox Author
Points: 33,170, Level: 79
Points: 33,170, Level: 79 Points: 33,170, Level: 79 Points: 33,170, Level: 79
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,161
Thanks: 7
Thanked 188 Times in 186 Posts
Default

What happens when you modify the loop like this:
Code:
Response.Write("Location is " & Request.Form("locations") & "<br />")

For Each location In Request.Form("locations")
  set cominsert = Server.CreateObject("ADODB.Command")
  cominsert.ActiveConnection = MM_sample_tracking_STRING
  cominsert.CommandText = "INSERT INTO tblsamples (Freezer, Tower, Box, Location, UPN, UPNA, Date_Drawn, Date_Stored, Person_Storing, Total_Vials, Freezing_Method, Comments)  VALUES ('" + Replace(cominsert__varfreezer, "'", "''") + "', '" + Replace(cominsert__vartower, "'", "''") + "', '" + Replace(cominsert__varbox, "'", "''") + "', '" + Replace(cominsert__varlocation, "'", "''") + "', '" + Replace(cominsert__varupn, "'", "''") + "', '" + Replace(cominsert__varupna, "'", "''") + "', '" + Replace(cominsert__vardate_drawn, "'", "''") + "', '" + Replace(cominsert__vardate_stored, "'", "''") + "', '" + Replace(cominsert__varperson_storing, "'", "''") + "', '" + Replace(cominsert__vartotal_vials, "'", "''") + "', '" + Replace(cominsert__varfreezing_method, "'", "''") + "', '" + Replace(cominsert__varcomments, "'", "''") + "') "

'cominsert.CommandType = 1
'cominsert.CommandTimeout = 0
'cominsert.Prepared = true
'cominsert.Execute()
Response.Write("Sql Statement is " & cominsert.CommandText & "<br />")

Next
What do you get? Multiple Sql statements?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #13 (permalink)  
Old June 16th, 2005, 05:28 PM
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sent you an email with the output. Can't seem to get the forum reply to work right now.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #14 (permalink)  
Old June 16th, 2005, 05:31 PM
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OOPS - forum is working just fine - the screen has been stretched though! Here is the output:

' 'Location is 001, 002, 003, 005, 006
Sql Statement is INSERT INTO tblsamples (Freezer, Tower, Box, Location, UPN, UPNA, Date_Drawn, Date_Stored, Person_Storing, Total_Vials, Freezing_Method, Comments) VALUES ('Cryo-3', '16', 'E', '001, 002, 003, 005, 006', '001', 'A', '06/16/2005', '06/16/2005', 'name', '', 'Control Rate', '')
Sql Statement is INSERT INTO tblsamples (Freezer, Tower, Box, Location, UPN, UPNA, Date_Drawn, Date_Stored, Person_Storing, Total_Vials, Freezing_Method, Comments) VALUES ('Cryo-3', '16', 'E', '001, 002, 003, 005, 006', '001', 'A', '06/16/2005', '06/16/2005', 'name', '', 'Control Rate', '')
Sql Statement is INSERT INTO tblsamples (Freezer, Tower, Box, Location, UPN, UPNA, Date_Drawn, Date_Stored, Person_Storing, Total_Vials, Freezing_Method, Comments) VALUES ('Cryo-3', '16', 'E', '001, 002, 003, 005, 006', '001', 'A', '06/16/2005', '06/16/2005', 'name', '', 'Control Rate', '')
Sql Statement is INSERT INTO tblsamples (Freezer, Tower, Box, Location, UPN, UPNA, Date_Drawn, Date_Stored, Person_Storing, Total_Vials, Freezing_Method, Comments) VALUES ('Cryo-3', '16', 'E', '001, 002, 003, 005, 006', '001', 'A', '06/16/2005', '06/16/2005', 'name', '', 'Control Rate', '')
Sql Statement is INSERT INTO tblsamples (Freezer, Tower, Box, Location, UPN, UPNA, Date_Drawn, Date_Stored, Person_Storing, Total_Vials, Freezing_Method, Comments) VALUES ('Cryo-3', '16', 'E', '001, 002, 003, 005, 006', '001', 'A', '06/16/2005', '06/16/2005', 'name', '', 'Control Rate', '')

I am not sure if this will help or not. Looks like it is looping - but the all of the selections seem to be entered into the database.

Chris
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #15 (permalink)  
Old June 17th, 2005, 02:20 AM
Imar's Avatar
Wrox Author
Points: 33,170, Level: 79
Points: 33,170, Level: 79 Points: 33,170, Level: 79 Points: 33,170, Level: 79
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,161
Thanks: 7
Thanked 188 Times in 186 Posts
Default

I think this is the problem:
Code:
if(Request.Form("locations") <> "") then cominsert__varlocation = Request.Form("locations")
You assign the value of Request.Form("locations") to cominsert__varlocation. However, the locations is now a form item that can have multiple items. So, you should no longer store it in cominsert__varlocation, but use location in your query instead:
Code:
cominsert.CommandText = "INSERT INTO tblsamples (Freezer, Tower, Box, Location, UPN, UPNA, Date_Drawn, Date_Stored, Person_Storing, 
Total_Vials, Freezing_Method, Comments)  VALUES ('" + Replace
(cominsert__varfreezer, "'", "''") + "', '" + Replace
(cominsert__vartower, "'", "''") + "', '" + Replace
(cominsert__varbox, "'", "''") + "', '" + Replace
(location, "'", "''") + "', '" + Replace
(cominsert__varupn, "'", "''") + "', '" + Replace
(cominsert__varupna, "'", "''") + "', '" + Replace
(cominsert__vardate_drawn, "'", "''") + "', '" + Replace
(cominsert__vardate_stored, "'", "''") + "', '" + Replace
(cominsert__varperson_storing, "'", "''") + "', '" + Replace
(cominsert__vartotal_vials, "'", "''") + "', '" + Replace
(cominsert__varfreezing_method, "'", "''") + "', '" + Replace
(cominsert__varcomments, "'", "''") + "') "
Does that make sense? instead of the comma separated form value (e.g. 001, 002, 003) you know use each location in the loop (e.g. 001, then 002, and in he next iteration 003 and so on).

If you look at the output you posted, you can see that it's executing 6 identical queries. By making the above changes, I think that should be fixed.

Can you please start a new thread if you have more questions? We ruined this one a bit with all those way too long queries.... I can hardly read it anymore....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sql Insert -- date format issue feets Access VBA 2 June 12th, 2007 01:11 PM
Insert Issue into Acces DB brawny4 Visual Basic 2005 Basics 2 February 21st, 2007 08:43 PM
Ch10 - issue with insert in log table Cata BOOK: Professional SQL Server 2005 Administration ISBN: 0-470-05520-0 0 February 15th, 2007 05:17 PM
trigger to insert current date on insert kev_79 SQL Server 2000 3 January 23rd, 2006 05:58 PM
Insert Issue revisited cedwards Dreamweaver (all versions) 13 June 21st, 2005 04:02 PM



All times are GMT -4. The time now is 10:10 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc