This is driving me insanse. I have a not very complicated form which passes to a page that SHOULD put the form details into the database. I can build up the SQL statement fine, but when I try to execute the statement I get a 500 error. The code for the execute page is...
=======valadduser.asp==========
<%
If Session("UserLevel" <> 2 Then Response.Redirect("default.asp"
'Check user is logged in as admin
username = Request.Form("Username"
password = Request.Form("password"
email = Request.Form("email"
displayname = Request.Form("DisplayName"
Level = Request.Form("Level"
'Get form values
Dim DBmcc, dbPath, DBrs
dbPath = server.MapPath("../data/data.mdb"
Set DBmcc = Server.CreateObject ("ADODB.Connection"
DBmcc.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath
'
SQL="INSERT INTO Users (Username, Password, email, DisplayName, ULevel) VALUES ('" & username & "', '" & password & "', '" & email & "', '" & displayname & "', "& level & ""
Response.Write SQL
DBmcc.Execute SQL
'Generate SQL and execute it
DBmcc.Close
set DBmcc = nothing
'Tidy Up
Response.Redirect("../default.asp"
'Return user to admin default screen
%>
======================
BUT, if I comment out the DBmcc.Execute SQL line the page compiles properly, and I get a valid SQL statement shown, like...
INSERT INTO Users (Username, Password, Email, DisplayName, Level) Values ('test', 'test', 'test@test.com', 'Test', 1)
Which also executes fine if I cut and paste into an Access Query. This is driving me mad. Does anyone notice anything I don't. Oh and the first 4 fields are text, while the last field is numeric.
Thanks in Advance
G -GTM Solutions, Home of USITE-
-=
=======valadduser.asp==========
<%
If Session("UserLevel" <> 2 Then Response.Redirect("default.asp"
'Check user is logged in as admin
username = Request.Form("Username"
password = Request.Form("password"
email = Request.Form("email"
displayname = Request.Form("DisplayName"
Level = Request.Form("Level"
'Get form values
Dim DBmcc, dbPath, DBrs
dbPath = server.MapPath("../data/data.mdb"
Set DBmcc = Server.CreateObject ("ADODB.Connection"
DBmcc.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath
'
SQL="INSERT INTO Users (Username, Password, email, DisplayName, ULevel) VALUES ('" & username & "', '" & password & "', '" & email & "', '" & displayname & "', "& level & ""
Response.Write SQL
DBmcc.Execute SQL
'Generate SQL and execute it
DBmcc.Close
set DBmcc = nothing
'Tidy Up
Response.Redirect("../default.asp"
'Return user to admin default screen
%>
======================
BUT, if I comment out the DBmcc.Execute SQL line the page compiles properly, and I get a valid SQL statement shown, like...
INSERT INTO Users (Username, Password, Email, DisplayName, Level) Values ('test', 'test', 'test@test.com', 'Test', 1)
Which also executes fine if I cut and paste into an Access Query. This is driving me mad. Does anyone notice anything I don't. Oh and the first 4 fields are text, while the last field is numeric.
Thanks in Advance
G -GTM Solutions, Home of USITE-
-=