Recordset error when attempting an update

Results 1 to 5 of 5

Thread: Recordset error when attempting an update

  1. #1
    jim d. Guest

    Default Recordset error when attempting an update

    I am getting an odd error when trying to update a few fields in a recordset:<BR><BR>"Query cannot be updated because the FROM clause is not a single simple table name."<BR><BR>So, I have localized a bug to the following few steps:<BR><BR>--------------------------------------------<BR>set objConn = Server.createobject("adodb.connection")<BR>objConn .open("dsn=customers")<BR><BR>strSQL = "SELECT * FROM [customers] WHERE [id] = 4"<BR><BR>response.write strSql &#039;for debugging<BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR>objRS.Op en strSQL, objConn, adOpenForwardOnly, adLockOptimistic<BR><BR><BR>objrs("username") = "John Doe"<BR>objRS.Update &#039;commit the changes<BR>--------------------------------------------------<BR><BR>Now, I don&#039;t get the error if I simply take out the square brackets from the sql statement, but I am hesitant to do so because it doesn&#039;t really explain the problem. Also, the square brackets are quite prevalent in Scott Mitchell&#039;s DatabaseModification classes, and I can&#039;t imagine he&#039;d use them if it caused such a problem.<BR><BR>Any takers?<BR><BR>ps: Thanks Bill W. for looking into a related question yesterday.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Recordset error when attempting an update

    as i know, [] are used in access only.(not 100% sure).what is ur db?may be that is the reason?

  3. #3
    Evel Knievel Guest

    Default RE: Recordset error when attempting an update

    Take those square brackets out NOW !<BR><BR>They are just put there in textbooks etc to show that you insert your own personal table name.<BR><BR>If you get another error , post it here.

  4. #4
    jim d. Guest

    Default Using SQL Server 7...

    But for fun, I set up another datasource using an access driver. It worked fine.<BR><BR>Unfortuately, that doesn&#039;t help me. I made a simplified example based on some code that supposedly works on both a sql server and access db (specifically, I downloaded the CODEREUSE code that accompanies Scott Mitchell&#039;s book). Before I tinker w/ code, I was hoping it was just an issue of me having an older driver or something. <BR><BR>

  5. #5
    jim d. Guest

    Default Nope.

    Nah. In this case, I am using the brackets as a delimiter. Not necessary in the example I&#039;ve shown, but necessary for table names that have spaces.

Posting Permissions

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