qaidskey
February 14th, 2003, 09:35 PM
i have a problem with some code. im trying to write an asp program that will add some a new record into a database table (with asp ado and sql). heres the code:
html>
<body>
<%
on error resume next
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:\Inetpub\wwwroot\BNB\bnbuserbase\bnb.mdb"
sql="INSERT INTO UserInfo"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("username") & "',"
sql=sql & "'" & Request.Form("pwd") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & Request.Form("fname") & "',"
sql=sql & "'" & Request.Form("lname") & "',"
sql=sql & "'" & Request.Form("telnum") & "',"
sql=sql & "'" & Request.Form("worknum") & "',"
sql=sql & "'" & Request.Form("street") & "',"
sql=sql & "'" & Request.Form("city") & "',"
sql=sql & "'" & Request.Form("zippost") & "',"
sql=sql & "'" & Request.Form("stateprov") & "',"
sql=sql & "'" & Request.Form("country") & "',"
sql=sql & "'" & Response.write(date()) & "',"
sql=sql & "'No')"
conn.Execute sql
if err <> 0 then
objerr.description
objerr.nativeerror
objerr.source
else
end if
conn.close
%>
</body>
</html>
as you can see there are some form entries that need to be added. and one that i want to be the only one to control. when i test it out. i get no error objects but it still doesn't work. if i remembore the "if err..." part it gives me an internet explorer error and tells me that line 26 or w/e (the 'conn.execute sql' part) and that it has to be an updatable query. i dun't know why this happens. any help out there?
html>
<body>
<%
on error resume next
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:\Inetpub\wwwroot\BNB\bnbuserbase\bnb.mdb"
sql="INSERT INTO UserInfo"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("username") & "',"
sql=sql & "'" & Request.Form("pwd") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & Request.Form("fname") & "',"
sql=sql & "'" & Request.Form("lname") & "',"
sql=sql & "'" & Request.Form("telnum") & "',"
sql=sql & "'" & Request.Form("worknum") & "',"
sql=sql & "'" & Request.Form("street") & "',"
sql=sql & "'" & Request.Form("city") & "',"
sql=sql & "'" & Request.Form("zippost") & "',"
sql=sql & "'" & Request.Form("stateprov") & "',"
sql=sql & "'" & Request.Form("country") & "',"
sql=sql & "'" & Response.write(date()) & "',"
sql=sql & "'No')"
conn.Execute sql
if err <> 0 then
objerr.description
objerr.nativeerror
objerr.source
else
end if
conn.close
%>
</body>
</html>
as you can see there are some form entries that need to be added. and one that i want to be the only one to control. when i test it out. i get no error objects but it still doesn't work. if i remembore the "if err..." part it gives me an internet explorer error and tells me that line 26 or w/e (the 'conn.execute sql' part) and that it has to be an updatable query. i dun't know why this happens. any help out there?