Click to See Complete Forum and Search --> : SQL INSERT doen't do as it say's


kogg
June 9th, 2003, 07:40 AM
Hello

I am trying to get the asp file below to run, the database is opened but it keeps failing on the conn.Execute sql,recaffected. I'll be damd if I know what the problem is.

Any of you guys know what coult be the problem?

Thanks kogg

<html>
<body><%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:\Inetpub\wwwroot\t\sample.mdb"
'6
sql="INSERT INTO Friends (customerID,companyname,contactname,address,city,postalcode,country)"

sql=sql & " VALUES "

sql=sql & "('" & Request.Form("custid") & "',"

sql=sql & "'" & Request.Form("compname") & "',"

sql=sql & "'" & Request.Form("contname") & "',"
'16
sql=sql & "'" & Request.Form("address") & "',"

sql=sql & "'" & Request.Form("city") & "',"

sql=sql & "'" & Request.Form("postcode") & "',"

sql=sql & "'" & Request.Form("country") & "')"
'24
on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write("No update permissions!")
else
Response.Write("<h3>" & recaffected & " record added</h3>")
end if
conn.close
%>

</body>
</html>

nmarun
June 16th, 2003, 07:42 PM
Hey kogg,

Can we have more details on the question?? What kind of error are you getting or what's the message of the error? What's the insert statement look like?

Wish to be more helpful..