problems adding record to access database

S

Sérgio Almeida

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top