Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
How to stuff multiple s into the DB??
[b][red]This message was edited by RadarBob at 2002-8-19 7:37:43[/red][/b][hr]
I'm having the worst time getting what I think should be a simple thing to work. In the Request.Form I'm passing the values from a multiple . I'm trying to get them into an MS SQL Server 7 database. Below is the code (that doesn't work). Here's basically what I'm trying to do: (1)create a brand new recordset. (2)loop through the Request.Form collection and create a new record in the recordset for each value. (3)kick off a stored procedure to put the recordset into the database. What does work: * The stored procedure works. * The values are definitely being passed in the Request.Form * The connection object I'm using is open. In code immediately above the code I've shown here, other data is successfully being inserted into the DB via a command object using the same connection. * SessPersonID and DbID are VBScript variables and both have valid values assigned. Notes: *the echoing back of the data inside the loop is for debug purposes. BTW I get *nothing* in response - not even an error message. Oh, the script times out. *I have tried rsDBKeywords.Update inside the loop and rsDBKeywords.UpdateBatch just after the loop (but not both at the same time!) [code] set rsDBKeywords = Server.CreateObject("ADODB.Recordset") rsDBKeywords.ActiveConnection = objConnection rsDBKeywords.Source = "exec up_scDBKeywordsAdd 'DbID'" rsDBKeywords.CursorType = 0 'adOpenForwardOnly rsDBKeywords.CursorLocation = 2 'on the server rsDBKeywords.LockType = 3 rsDBKeywords.Open Response.Write " Keyword Record Values " Dim i for i=1 to Response.Form("fkeywords").Count rsDBKeywords.AddNew rsDBKeywords.Fields("person_ID") = SessPersonID rsDBKeywords.Fields("database_ID") = DbID rsDBKeywords.Fields("keyword") = Request.Form("fKeywords")(i) rsDBKeywords.Update Request.Write "Person ID " & i & " = " & rsDBKeywords.Fields("person_ID") & "" Request.Write "Database ID " & i & " = " & rsDBKeywords.Fields("database_ID") & "" Request.Write "Keyword" & i & " = " & rsDBKeywords.Fields("keyword") & "" next [/code]
0 · ·