RhythmAddict112
Programmer
Hi all. I have no idea why I am getting this error. Ive checked and rechecked everything I can think of...The SQL statement prints fine....
Basically, I am trying to insert a few fields into an access database.
the code for the page is below, as is the response.write of the sql query
page:
Response.write of the SQL:
Any help would be great! thank you in advance
Basically, I am trying to insert a few fields into an access database.
the code for the page is below, as is the response.write of the sql query
page:
Code:
<% @ Language="VBScript" %>
<% Option Explicit %>
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
'declare your variables
Dim name, pass, email, inst, city, st, position, currdate, user
Dim sConnString, connection, sSQL
' Receiving values from Form, assign the values entered to variables
user = Request.Form("user")
pass = Request.Form("pass")
email = Request.Form("email")
inst = Request.form("inst")
city = Request.form("city")
st = Request.form("st")
position = Request.form("position")
Currdate = Now()
'declare SQL statement that will query the database
sSQL = "INSERT into users_tbl (user, pass, email, inst, city, st, position, dt) values ('" & _
user & "', '" & pass & "', '" & email & "','" & inst & "','" & city & "','" & st & "','" & position & "','" & CurrDate & "')"
'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("Users.mdb")
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")
'Open the connection to the database
connection.Open(sConnString)
'execute the SQL
connection.execute(sSQL)
response.write ssql
response.write "The form information was inserted successfully."
' Done. Close the connection object
connection.Close
Set connection = Nothing
%>
</body>
</html>
Response.write of the SQL:
Code:
INSERT into users_tbl (user, pass, email, inst, city, st, position, dt) values ('username', 'password', 'emailfield','company','city','nj','thisone','7/30/2004 12:38:58 AM')