PDA

View Full Version : Problems uploading to Access Database.


flash
11-29-2002, 12:13 PM
Hello.

I am having problems uploading to an Access database.

Here is the code I am using. Connect.asp holds the connection information for the database.



<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="../../includes/connect.asp" -->

<%
if (String(Request.QueryString("submit")) != "undefined") {

var strSQL = "INSERT INTO mod1 (Modulator, Emailaddress, Password, Telnum)"

strSQL += " values ('" + String(Request.Form("Modulator")).replace(/'/g,"''") + "', ";
strSQL += "'" + String(Request.Form("Email_address")).replace(/'/g,"''") + "', ";
strSQL += "'" + String(Request.Form("Password")).replace(/'/g,"''") + "', ";
strSQL += "'" + String(Request.Form("Telnum")).replace(/'/g,"''") + "')";

//Response.Write(strSQL)
//Response.End()

var insertCmd = Server.CreateObject("ADODB.Command");
insertCmd.ActiveConnection = conn;
insertCmd.CommandText = strSQL;
insertCmd.Execute();
insertCmd.ActiveConnection.Close();
Response.Redirect("show_mods.asp");
}

%>



When I submit the page I get the error:

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/fault/cp/admin/add_mod.asp, line 20


Any ideas?!?!?!?

Thanks.

Flash

flash
12-02-2002, 03:35 PM
Hey all.

I fixed the problem.
Some of the field names I was using were "Reserved names".
I added db infront of my table names in the database and now everything is fine.

Kinda strange how there was 35 views on this thread and not a single reply to try and help :rolleyes:

whammy
12-03-2002, 12:49 AM
Sorry, I just got home from work and looked at it. ;)

Most people probably looked at your code and thought it looked all right, therefore they didn't answer since it wouldn't have been any help. No answer is better than a misleading one, at any rate...

I think the culprit there was your "Password" field, since I know that password is a reserved word in Access. The others aren't as far as I know. :D

flash
12-04-2002, 12:01 PM
:thumbsup: Thanks