Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > problems adding record to access database

Reply
Thread Tools

problems adding record to access database

 
 
SÚrgio Almeida
Guest
Posts: n/a
 
      10-24-2003
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

 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      10-24-2003
www.aspfaq.com/5003

Ray at work

"SÚrgio Almeida" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Greetings
>
> I'm having problems adding records to an access database.
> What I want to do is very simple. Here is my code.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Adding new record using previous record information... help!! Maximus ASP General 2 04-12-2007 09:55 PM
insert record in Access database nicholas ASP .Net 1 10-28-2004 03:41 PM
insert record in Ms Access database AND retrieve the autonumber (ID) nicholas ASP .Net 4 10-20-2004 04:02 PM



Advertisments