If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Insert multiple rows to an accessdatabas table?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-17-06, 03:10
Td04 Td04 is offline
Registered User
 
Join Date: Mar 2004
Posts: 52
Angry Insert multiple rows to an accessdatabas table?

I try to split a javascript array by sendig it to the asp page save to an asp array, then split up the array.
Then I would like to loop thrue the array and I put the "insert into the database" statement inside the loop to insert the records into an access database table, but somhow it doesnt work.
If I use the insert statement once it works fine.

Any bright ideas?
Thanks//Martin
here is the code

<%session("login") = Request.ServerVariables("AUTH_USER")
session("login") = "admMNT"

strProvider="Driver=Microsoft Access Driver (*.mdb); DBQ=c:\Inetpub\wwwroot\favo\FavoritLager.mdb;"
set objConn = server.createobject("ADODB.Connection")
objConn.Open strProvider
set cm = Server.CreateObject("ADODB.Command")
cm.ActiveConnection = objConn



'lagerSynlighet = request.queryString("lagerSynlighet")
lagerSynlighet = "0,1,1,1,2,1,3,0,4,0,5,1,6,1,7,1,8,0,9,1,10,0"
'myArray1 =
myArray = split(lagerSynlighet,",")

%>
<html>
<head>
<title>H&#228;mta Favoritlager</title>
</head>

<body>
<%
FOR i=0 TO UBound(myArray)
i=i+1

cm.CommandText ="INSERT INTO FavoritLager(LoginId,LagerOrdning,Lagersynlighet) VALUES (?,?,?)"
set objparam=cm.createparameter(, 200, , 255,session("login"))
cm.parameters.append objparam
set objparam=cm.createparameter(, 200, , 255,myArray(i))
cm.parameters.append objparam
set objparam=cm.createparameter(, 200, , 255, myArray(i))
cm.parameters.append objparam
cm.execute
Set objparam = Nothing

Next

%>
</body>
</html>
__________________
"Never underestimate a large number of morons"
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On