Results 1 to 2 of 2

Thread: Upating a database with ASP

  1. #1
    Guest

    Angry

    Hi there, I really would like some assitance in writing to my database.

    Now here's my problem: I'm able to read from my database but when ever I attempt to update it I get an error message on my IE5 browser.

    Here's the code that are working fine:

    <%
    set DBObj = server.createobject("ADODB.connection")
    DBObj.open "TaskManager"
    sqlquery = " SELECT Month, Day, Date FROM Selected_Month WHERE Month = 'October' "
    set RSGetMonth = DBObj.execute(sqlquery)
    DayOfWeek = RSGetMonth("Day")
    DateOfWeek = RSGetMonth("Date")
    DBObj.close
    response.write "<p> Day of week =" &DayOfWeek& "</p>
    response.write "Date of week = " &DateOfWeek
    %>

    The above reads the appropriate data from the database but when I try the following I get error messages:

    <%set DBObj = server.createobject("ADODB.connection")
    DBObj.open "TaskManager"
    query = " UPDATE Calendar SET Date = 2 WHERE Day = 'Monday1' "
    set RS = DBObj.execute(query)
    DBObj.close
    %>


    I get error on the "set RS = DBObj.execute(query)" line
    saying: Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [Microsoft][ODBC Microsoft Access Driver] syntas error in UPDATE statement

    If you could provide me with the initital few lines of codes to establish a connection in order to write to the database it will be very much appreciated.



  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Your trying to assign a recordset to an action query that does not return a dataset.

    An update statement will not return a dataset of the records that were updated.

    Try this instead:

    Code:
    DBObj.execute query
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width