elockste
asked on
Mysterious Empty entries in an Access Database connected with ASP pages
I have several tables in access that overnight will mysteriously add an empty row into my data. I fear I am leaving a connection open that is causing this. Has anyone heard of this or has any possible solution.
Here is an example of code I use. How I open and close the connection:
dim cnn,rst
set cnn = Server.CreateObject("ADODB .Connectio n")
set rst = Server.CreateObject("ADODB .RecordSet ")
Cnn.Open "driver={Microsoft Access Driver (*.mdb)};;DBQ=d:/inetpub/w wwroot/EDl earning/tr aining_req uest/Datab ase/reques ts.mdb;"
sqltext = "SELECT * FROM deliver_existing"
rst.Open sqltext,cnn,3,3
'Server Side form validation to keep our database clean
dim request_id, currentdate, userid, location, name, position, division, email, telephone, align, align_descrip, course_name, tlc_code, receive, numtrain, time, train_location
currentdate = Request.Form("currentdate" )
userid = Request.Form("userid")
location = Request.Form("location")
name = Request.Form("name")
position = Request.Form("position")
division = Request.Form("division")
email = Request.Form("email")
telephone = Request.Form("telephone")
align = Request.Form("align")
align_descrip = Request.Form("align_descri p")
course_name = Request.Form("course_name" )
tlc_code = Request.Form("tlc_code")
receive = Request.Form("receive")
numtrain = Request.Form("numtrain")
time = Request.Form("time")
train_location = Request.Form("train_locati on")
rst.AddNew
rst("currentdate") = currentdate
rst("userid") = userid
rst("location") = location
rst("name") = name
rst("position") = position
rst("division") = division
rst("email") = email
rst("telephone") = telephone
rst("align") = align
rst("align_descrip") = align_descrip
rst("course_name") = course_name
rst("tlc_code") = tlc_code
rst("receive") = receive
rst("numtrain") = numtrain
rst("time") = time
rst("train_location") = train_location
rst.update
cnn.close
Here is an example of code I use. How I open and close the connection:
dim cnn,rst
set cnn = Server.CreateObject("ADODB
set rst = Server.CreateObject("ADODB
Cnn.Open "driver={Microsoft Access Driver (*.mdb)};;DBQ=d:/inetpub/w
sqltext = "SELECT * FROM deliver_existing"
rst.Open sqltext,cnn,3,3
'Server Side form validation to keep our database clean
dim request_id, currentdate, userid, location, name, position, division, email, telephone, align, align_descrip, course_name, tlc_code, receive, numtrain, time, train_location
currentdate = Request.Form("currentdate"
userid = Request.Form("userid")
location = Request.Form("location")
name = Request.Form("name")
position = Request.Form("position")
division = Request.Form("division")
email = Request.Form("email")
telephone = Request.Form("telephone")
align = Request.Form("align")
align_descrip = Request.Form("align_descri
course_name = Request.Form("course_name"
tlc_code = Request.Form("tlc_code")
receive = Request.Form("receive")
numtrain = Request.Form("numtrain")
time = Request.Form("time")
train_location = Request.Form("train_locati
rst.AddNew
rst("currentdate") = currentdate
rst("userid") = userid
rst("location") = location
rst("name") = name
rst("position") = position
rst("division") = division
rst("email") = email
rst("telephone") = telephone
rst("align") = align
rst("align_descrip") = align_descrip
rst("course_name") = course_name
rst("tlc_code") = tlc_code
rst("receive") = receive
rst("numtrain") = numtrain
rst("time") = time
rst("train_location") = train_location
rst.update
cnn.close
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the result is same then try using as
sql="Insert into myTable values('"&Request.Form("cu rrentdate" )&"','" &Request.Form("userid")&"' ,'"&Reques t.Form("lo cation")&" ','"&Reque st.Form("n ame")&"',' "&Request. Form("posi tion")&"', '"&Request .Form("div ision")&"' ,'"&Reques t.Form("em ail")&"',. .......... ."
CNN.Execute (sql)
CNN.close
There is no need of recordset here.
sql="Insert into myTable values('"&Request.Form("cu
CNN.Execute (sql)
CNN.close
There is no need of recordset here.
ASKER