Forum Moderators: open

Message Too Old, No Replies

Trying to save Multiple rows of info into an MS Access table

         

pietrop

10:19 pm on Apr 28, 2004 (gmt 0)



Hey guys,

I am having an absolute nightmare of a time with ASP.

Basically this is the low down, i have pulled some info from a table in access and displayed it in an html document, i need to change some of the details in that form so i have made 2 of the fields text fields. All that is fine but for some reason the DAMN thing will not let me save into another table in access, i have tried everything and i am now tryin to do it using arrays, this is what the code looks like but i have no idea if it is right because i am at the point of no return, its been a week on the same problem and now i cant tell lef from right!This is the file that is SUPPOSED to save the info into another table:

*************
<%@ Language = "VBScript"%>
<%

'Declare all local variables

dim conn
dim rs
dim strconn
dim strsql

Dim ID
Dim GameDate
Dim HomeScore
Dim AwayScore
Dim HomeT
Dim AwayT

Id = Array(0,1,2,3,4)
ID(0) = request("id1")
ID(1) = request("id2")
ID(2) = request("id3")
ID(3) = request("id4")
ID(4) = request("id5")

GameDate = Array(0,1,2,3,4)
GameDate(0) = request("GameDate1")
GameDate(1) = request("GameDate2")
GameDate(2) = request("GameDate3")
GameDate(3) = request("GameDate4")
GameDate(4) = request("GameDate5")

HomeScore = Array(0,1,2,3,4)
HomeScore(0) = Request("Home_score1")
HomeScore(1) = Request("Home_score2")
HomeScore(2) = Request("Home_score3")
HomeScore(3) = Request("Home_score4")
HomeScore(4) = Request("Home_score5")

AwayScore = Array(0,1,2,3,4)
AwayScore(0) = request("AwayScore1")
AwayScore(1) = request("AwayScore2")
AwayScore(2) = request("AwayScore3")
AwayScore(3) = request("AwayScore4")
AwayScore(4) = request("AwayScore5")

HomeT = Array(0,1,2,3,4)
HomeT(0) = Request("Home1")
HomeT(1) = Request("Home2")
HomeT(2) = Request("Home3")
HomeT(3) = Request("Home4")
HomeT(4) = Request("Home5")

AwayT = Array(0,1,2,3,4)
AwayT(0) = Request("Away1")
AwayT(1) = Request("Away2")
AwayT(2) = Request("Away3")
AwayT(3) = Request("Away4")
AwayT(4) = Request("Away5")

strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("\DIGFootball\db\DIG.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn

For x = 0 to 4
strSQL = "INSERT INTO TEMPDiv3Mon(id, gamedate, home, home_score, away, awayscore) values ('" & Id(x) & "','" & gamedate(x) & "','" & HomeT(x) & "','" & Homescore(x) & "','" & AwayT(x) & "','" & AwayScore(x) & "');"

conn.execute(strSQL)

Next

conn.close
set conn = nothing

%>

<% = "Your record has been added" %>

<p><br>

</p>

<p><a href="ShowFixtures.asp">Click here to return to the start page of the demo</a></p>

<p>&nbsp;</p>
<p>&nbsp;</p>
***********

At this point any help will be pretty much life saving as i am on the verge!

Please any help will be MOST appreciated!

Thanks for taking the time to read this

mattglet

1:49 pm on Apr 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you getting an error?

-Matt