"insert" data in an access 2003

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

  1. Hi, I have a database driven website and post this once without getting anywhere.:( I hope this try could help me to fix the problem.

    The site is .asp. 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 :confused:
    *can not insert new data in a table :confused:

    This is the codes that had worked in another host in the past.

    my codes

    filePath = Server.MapPath("db\*.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) ​
     

Share This Page