problems adding record to access database

Discussion in 'ASP General' started by Sérgio Almeida, Oct 24, 2003.

  1. 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, Oct 24, 2003
    #1
    1. Advertising

  2. Sérgio Almeida

    Ray at Guest

    www.aspfaq.com/5003

    Ray at work

    "Sérgio Almeida" <> wrote in message
    news:...
    > 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, Oct 24, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nicholas
    Replies:
    4
    Views:
    11,350
  2. nicholas

    insert record in Access database

    nicholas, Oct 28, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    5,832
    nicholas
    Oct 28, 2004
  3. Shapper
    Replies:
    2
    Views:
    586
    Paul Clement
    Jul 7, 2005
  4. izzahmeor
    Replies:
    0
    Views:
    814
    izzahmeor
    Feb 3, 2010
  5. Maximus
    Replies:
    2
    Views:
    207
    Bob Barrows [MVP]
    Apr 12, 2007
Loading...

Share This Page