Ask a Question related to ASP Database, Design and Development.
-
insert into MS Access issue #1
Insert issue
I have the following code in an ASP page that is processing a form to create a new user. I keep getting the following error
Microsoft JET Database Engine (0x80040E14
Syntax error in INSERT INTO statement
The database is MS Access, the latest, I am able to perform select statements on it and do everything except write to the database. The insert statement created is as follows
insert into UserTable ( UserName, Password, EmployeeID, AccessRight, EmailAddress, ProjectID ) values ('why' ,'why' ,'121212' , 0, 'why@c.com' ,1
Where everything is text except, AccessRight and ProjectID which are numbers (long integer).
I have taken care of the permissions issue, I am not sure what I am doing wrong, any help would be appreciated ! Code follow
thank
Car
set dbConn = server.CreateObject("adodb.connection"
set recLgn = server.CreateObject("adodb.RecordSet"
' open the connectio
dbConn.Mode =
dbConn.Open Application("Database"
strDB = Application("Database"
strSQL = "insert into UserTable ( UserName, Password, EmployeeID, AccessRight, EmailAddress, ProjectID )values"
strSQL = strSQL & " ('" & user & "' ,'" & pass & "' ,'" & CSTR(employeeID) & "' , " & adminPriv & ", '" & eAddress & "' ," & nProjID & ")
dbConn.Execute strSQ
insert into MS Access issue Guest
-
What's faster - loop for insert or insert...select.
What is faster if I'm moving large numbers of records (anywhere from 10,000 to 300,000 records per archive) from one query to another table? 1)... -
Insert Link Issue
I've been having an issue with using 'Insert Link' - when linking to an external websites, the window freezes while trying to display a preview of... -
Multiple Insert or Looping Insert
I built an application on an Access DB that allows a dispatcher to log trucks in the field at their location as they call in. There are three... -
Login - multi table insert for registrant; subsquent login insert page requests into joined 'Selection' Table
Question regards insert and updates in sql server for a simple login script that requires registration the first time and only "email address" upon... -
INSERT statement contains fewer items than the insert list
The block of code below shows how I am inserting field values into my dbase table: strSQLStatement = "INSERT INTO tblArticles... -
McKirahan #2
Re: Insert issue
"insert into MS Access issue" <anonymous@discussions.microsoft.com> wrote in
message news:661A086D-17D4-455E-9BEB-65222D71C09C@microsoft.com...create a new user. I keep getting the following error:> I have the following code in an ASP page that is processing a form tostatements on it and do everything except write to the database. The insert>
> Microsoft JET Database Engine (0x80040E14)
> Syntax error in INSERT INTO statement.
>
> The database is MS Access, the latest, I am able to perform select
statement created is as follows:EmailAddress, ProjectID ) values ('why' ,'why' ,'121212' , 0, 'why@c.com'>
> insert into UserTable ( UserName, Password, EmployeeID, AccessRight,
,1)numbers (long integer).>
> Where everything is text except, AccessRight and ProjectID which arewrong, any help would be appreciated ! Code follows>
> I have taken care of the permissions issue, I am not sure what I am doingAccessRight, EmailAddress, ProjectID )values">
> thanks
> Carl
>
>
> set dbConn = server.CreateObject("adodb.connection")
> set recLgn = server.CreateObject("adodb.RecordSet")
>
> ' open the connection
> dbConn.Mode = 3
> dbConn.Open Application("Database")
> strDB = Application("Database")
> strSQL = "insert into UserTable ( UserName, Password, EmployeeID,& "' , " & adminPriv & ", '" & eAddress & "' ," & nProjID & ")"> strSQL = strSQL & " ('" & user & "' ,'" & pass & "' ,'" & CSTR(employeeID)> dbConn.Execute strSQL
Have you tried inserting a Response.Write(strSQL) before the dbConn.Execute
statement and then cut-and-paste it into an MS-Access query to see if it
works that way?
McKirahan Guest
-
Aaron Bertrand [MVP] #3
Re: Insert issue
Password is a reserved word and should not be used as a column name. If you
can't change it, you'll have to make the following edit to all SQL
statements:
INSERT ... (... , [Password], ...)
The square brackets tell the engine to pretend it's not a reserved word,
sort of...
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
"insert into MS Access issue" <anonymous@discussions.microsoft.com> wrote in
message news:661A086D-17D4-455E-9BEB-65222D71C09C@microsoft.com...>I have the following code in an ASP page that is processing a form to
>create a new user. I keep getting the following error:
>
> Microsoft JET Database Engine (0x80040E14)
> Syntax error in INSERT INTO statement.
>
> The database is MS Access, the latest, I am able to perform select
> statements on it and do everything except write to the database. The
> insert statement created is as follows:
>
> insert into UserTable ( UserName, Password, EmployeeID, AccessRight,
> EmailAddress, ProjectID ) values ('why' ,'why' ,'121212' , 0, 'why@c.com'
> ,1)
>
> Where everything is text except, AccessRight and ProjectID which are
> numbers (long integer).
>
> I have taken care of the permissions issue, I am not sure what I am doing
> wrong, any help would be appreciated ! Code follows
>
> thanks
> Carl
>
>
> set dbConn = server.CreateObject("adodb.connection")
> set recLgn = server.CreateObject("adodb.RecordSet")
>
> ' open the connection
> dbConn.Mode = 3
> dbConn.Open Application("Database")
> strDB = Application("Database")
> strSQL = "insert into UserTable ( UserName, Password, EmployeeID,
> AccessRight, EmailAddress, ProjectID )values"
> strSQL = strSQL & " ('" & user & "' ,'" & pass & "' ,'" & CSTR(employeeID)
> & "' , " & adminPriv & ", '" & eAddress & "' ," & nProjID & ")"
> dbConn.Execute strSQL
>
>
Aaron Bertrand [MVP] Guest
-
Bob Barrows [MVP] #4
Re: Insert issue
insert into MS Access issue wrote:
> I have the following code in an ASP page that is processing a form to
> create a new user. I keep getting the following error:
>
> Microsoft JET Database Engine (0x80040E14)
> Syntax error in INSERT INTO statement.
>
> The database is MS Access, the latest, I am able to perform select
> statements on it and do everything except write to the database. The
> insert statement created is as follows:
>
> insert into UserTable ( UserName, Password, EmployeeID, AccessRight,
> EmailAddress, ProjectID ) values ('why' ,'why' ,'121212' , 0,
> 'why@c.com' ,1)
>
Password is a reserved keyword and should not be used for a database object
name. My recommendation is to change the name of the field, but, if you
can't for some reason, then you will need to remember to surround it with
brackets when using it in a query called via ADO:
insert into UserTable ( UserName, [Password], ...
HTH,
bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Carl #5
Re: Insert issue
The Password in the table column was the issue thank you I would have never found this it was driving me crazy!
THANKS
Carl
Carl Guest



Reply With Quote

