Thread: Insert issue?
View Single Post
  #9 (permalink)  
Old June 16th, 2005, 04:34 PM
cedwards cedwards is offline
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK - I can't seem to get this to work - I am modifying a DM command insert - so that could be the problem: All it does is enter the first number I select - I guess it isn't looping through. Here is the code - any help would be appreciated!

<%

if(Request.Cookies("freezer") <> "") then cominsert__varfreezer = Request.Cookies("freezer")

if(Request.Cookies("tower") <> "") then cominsert__vartower = Request.Cookies("tower")

if(Request.Cookies("box") <> "") then cominsert__varbox = Request.Cookies("box")

if(Request.Form("locations") <> "") then cominsert__varlocation = Request.Form("locations")

if(Request.Form("upn") <> "") then cominsert__varupn = Request.Form("upn")

if(Request.Form("upna") <> "") then cominsert__varupna = Request.Form("upna")

if(Request.Form("date_drawn") <> "") then cominsert__vardate_drawn = Request.Form("date_drawn")

if(Request.Form("date_stored") <> "") then cominsert__vardate_stored = Request.Form("date_stored")

if(Request.Form("person_storing") <> "") then cominsert__varperson_storing = Request.Form("person_storing")

if(Request.Form("total_vials") <> "") then cominsert__vartotal_vials = Request.Form("total_vials")

if(Request.Form("freezing_method") <> "") then cominsert__varfreezing_method = Request.Form("freezing_method")

if(Request.Form("comments") <> "") then cominsert__varcomments = Request.Form("comments")

%>
<%
if Request.Form("locations") <> "" Then
  Dim location
    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()
   Next
End If
%>

That is it - let me know if you have any suggestions.

Chris

Reply With Quote