Ask a Question related to ASP Database, Design and Development.
-
Sérgio Almeida #1
problems adding record to access database
Greetings
I'm having problems adding records to an access database.
What I want to do is very simple. Here is my code.
__CODE_START__
dim sqlStatement
sqlStatement="insert into Records(artist,album,format,label,tracks,year)
values ('Pink Floyd','THE WALL','2CD','EMI',99,1979)"
dim dataConn
dim strDatabase, affecetd
strDatabase="database/musicstore.mdb"
Set dataConn = Server.CreateObject("ADODB.Connection")
dataConn.Provider="Microsoft.Jet.OLEDB.4.0"
dataConn.ConnectionTimeout = 15
dataConn.CommandTimeout = 30
dataConn.Open Server.MapPath(strDatabase)
dataconn.Execute sqlStatement,affected',adCmdText ' <- ERROR OCCURS HERE
if affecetd = 1 then
Response.Write("<h1> success </h1>")
end if
__CODE_END__
when I try run the cript I get the error
__ERROR_START__
Technical Information (for support personnel)
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/MusicStore/addrecord.asp, line 53
__ERROR_END__
If I run the sabe sql statement on "query analyser" of access, it works
ok (the record is inserted).
What can be the problem? any ideas?
Than you very much
Sérgio Almeida
Sérgio Almeida Guest
-
searching for record before adding to database
Hi all, Im creating a form, and I can now add and save the record. However, since we are concern on duplicate records, I use email as the field... -
Trouble with database access: can't edit record, just view it
Hallo! I use DWMX 6.1 and use ASP VBSCRIPT files to access a MS Access 2000 database. Initially I was able to edit the records. Then I had to add... -
FTP Problems with Access Database in MX
This is driving me crazy! All files will upload without any problems but when it comes to access database, sometimes it will upload fine, but most... -
editing record in access database
I am trying to pull a record into a form and then edit it. (not working to well) Hoping someone can show me a better way than this: <% option... -
deleting access database record
I am trying to write an asp page to delete a record from my access database. I have written the page to display the info but when I select the entry... -
Sérgio Almeida #2
problems adding record to access database
Greetings
I'm having problems adding records to an access database.
What I want to do is very simple. Here is my code.
__CODE_START__
dim sqlStatement
sqlStatement="insert into Records(artist,album,format,label,tracks,year)
values ('Pink Floyd','THE WALL','2CD','EMI',99,1979)"
dim dataConn
dim strDatabase, affecetd
strDatabase="database/musicstore.mdb"
Set dataConn = Server.CreateObject("ADODB.Connection")
dataConn.Provider="Microsoft.Jet.OLEDB.4.0"
dataConn.ConnectionTimeout = 15
dataConn.CommandTimeout = 30
dataConn.Open Server.MapPath(strDatabase)
dataconn.Execute sqlStatement,affected',adCmdText ' <- ERROR OCCURS HERE
if affecetd = 1 then
Response.Write("<h1> success </h1>")
end if
__CODE_END__
when I try run the cript I get the error
__ERROR_START__
Technical Information (for support personnel)
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/MusicStore/addrecord.asp, line 53
__ERROR_END__
If I run the sabe sql statement on "query analyser" of access, it works
ok (the record is inserted).
What can be the problem? any ideas?
Than you very much
Sérgio Almeida
Sérgio Almeida Guest
-
Ray at #3
Re: problems adding record to access database
[url]www.aspfaq.com/5003[/url]
Ray at work
"Sérgio Almeida" <sgalmeidaNOSPAM@bragatelNOSPAM.pt> wrote in message
news:ul$HuHlmDHA.2160@TK2MSFTNGP10.phx.gbl...> Greetings
>
> I'm having problems adding records to an access database.
> What I want to do is very simple. Here is my code.
>
Ray at Guest
-
Ray at #4
Re: problems adding record to access database
[url]www.aspfaq.com/5003[/url]
Ray at work
"Sérgio Almeida" <sgalmeidaNOSPAM@bragatelNOSPAM.pt> wrote in message
news:u1T8sHlmDHA.2432@TK2MSFTNGP10.phx.gbl...> Greetings
>
> I'm having problems adding records to an access database.
> What I want to do is very simple. Here is my code.
>
Ray at Guest
-
Bob Barrows #5
Re: problems adding record to access database
Sérgio Almeida wrote:
We seem to be having a rash of reserved words problems in the past couple> Greetings
>
> I'm having problems adding records to an access database.
> What I want to do is very simple. Here is my code.
>
> __CODE_START__
>
> dim sqlStatement
> sqlStatement="insert into
> Records(artist,album,format,label,tracks,year) values ('Pink
> Floyd','THE WALL','2CD','EMI',99,1979)"
>
> dataconn.Execute sqlStatement,affected',adCmdText ' <- ERROR OCCURS
> Error Type:
> Microsoft JET Database Engine (0x80040E14)
> Syntax error in INSERT INTO statement.
> /MusicStore/addrecord.asp, line 53
days :-)
"year" (and maybe "format") is a reserved word and should not be used for a
column name in your database. If you cannot change the name of the field in
your table, then you will need to surround it with brackets [] when running
queries containing those names from ADO.
Here is a list of reserved words which you should avoid when naming objects
in your database: [url]http://www.aspfaq.com/show.asp?id=2080[/url]
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
Sérgio Almeida #6
Re: problems adding record to access database
Than you Bob.
That worked, but now I get the error
Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/MusicStore/addrecord.asp, line 53
What mus I do?
Thanks once again.
Bob Barrows wrote:> Sérgio Almeida wrote:
>>>>Greetings
>>
>>I'm having problems adding records to an access database.
>>What I want to do is very simple. Here is my code.
>>
>>__CODE_START__
>>
>>dim sqlStatement
>>sqlStatement="insert into
>>Records(artist,album,format,label,tracks,year) values ('Pink
>>Floyd','THE WALL','2CD','EMI',99,1979)"
>>
>>dataconn.Execute sqlStatement,affected',adCmdText ' <- ERROR OCCURS
>>Error Type:
>>Microsoft JET Database Engine (0x80040E14)
>>Syntax error in INSERT INTO statement.
>>/MusicStore/addrecord.asp, line 53
>
> We seem to be having a rash of reserved words problems in the past couple
> days :-)
> "year" (and maybe "format") is a reserved word and should not be used for a
> column name in your database. If you cannot change the name of the field in
> your table, then you will need to surround it with brackets [] when running
> queries containing those names from ADO.
>
> Here is a list of reserved words which you should avoid when naming objects
> in your database: [url]http://www.aspfaq.com/show.asp?id=2080[/url]
>
> HTH,
> Bob BarrowsSérgio Almeida Guest
-
Bob Barrows #7
Re: problems adding record to access database
Sérgio Almeida wrote:
[url]http://www.aspfaq.com/show.asp?id=2062[/url]> Than you Bob.
> That worked, but now I get the error
>
> Error Type:
> Microsoft JET Database Engine (0x80004005)
> Operation must use an updateable query.
> /MusicStore/addrecord.asp, line 53
>
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest



Reply With Quote

