Asp query to insert data in an access 2003

Discussion in 'General troubleshooting' started by Rsafa, May 27, 2012.

  1. Hi
    I read everything I could find about access 2003 in the site. I can connect to my database, read from it and search in it. However I
    ---can not update the data in a table
    ---- can not insert new data in a table

    I was using the codes that had been working before in another host. Should I start writing the queries here or need to open a ticket?
     
  2. Support isn't going to be able to help with specific coding issues so you may want to post the queries here.
     
  3. my codes

    filePath = Server.MapPath("db\DietDtb.mdb")

    '-------open connection to the database

    Set mYconnection=Server.CreateObject("ADODB.Connection")
    mYconnection.Open("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" +filePath)

    '-------------- getting data from the form
    DIM selectedId , pTid, todayId, Note
    selectedId = Session("pTiDforDetail")
    pTid = Request("id4report")
    todayId = Date()
    Note = CStr( Request("noteTxt") )
    '-------------- starting to insert
    DIM Qinsert
    Qinsert = "INSERT INTO followTb"
    Qinsert = Qinsert & "(ID, ptID, dateOfvisit, noteforthisVisit)"
    Qinsert = Qinsert & "VALUES ('"&selectedId&"', '"&pTid&"', '"&todayId&"', '"&Note&"') "

    '--------------- in the table, ID and ptID are numbers and dateOfvisit is date
    Call mYconnection.Execute(Qinsert)
     
  4. Elshadriel

    Elshadriel Winhost Staff

    Are you getting an error message? You might also want to print your SQL query out to make sure it's syntactically correct (e.g. includes spaces, etc.)
     

Share This Page