Results 1 to 5 of 5

Thread: SQL Server UPDATE and DELETE

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Posts
    82
    I'm new to the VB/SQL Server world and am having the following problem:

    I get timeouts when executing either UPDATEs or DELETEs. INSERTs work fine.

    Here's the code ("PROJ_DB" is the connection):

    g_sSQL = "UPDATE tblRefI SET strType='A',sngRefI=1.23 WHERE strType='A';"
    PROJ_DB.Execute g_sSQL, , adCmdText

    and

    g_sSQL = "DELETE FROM tblRefI WHERE strType='X';"
    PROJ_DB.Execute g_sSQL, , adCmdText

    and

    g_sSQL = "INSERT INTO tblRefI (strType,sngRefI) VALUES('A',123);"
    PROJ_DB.Execute g_sSQL, , adCmdText

    If anyone can help, I'd really appreciate it. Thanks.

  2. #2
    Lively Member
    Join Date
    Mar 1999
    Posts
    93
    If you don't need to return records bask after update/delete, try to set parameter RecordsAffected=none in execute statement. This will reduce time needed for executing the query and maybe it will help
    Regards,
    Vit

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Posts
    82
    Vit:

    Thanks. I should mention that the table I'm testing my code on is a maintenance table with only 5 records.

    Could it have something to do with the WHERE phrase??

  4. #4
    Lively Member
    Join Date
    Mar 1999
    Posts
    93
    No, it's a correct syntax
    Regards,
    Vit

  5. #5
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284
    Really the correct syntax for comparing strings in SQL is where
    mythingy like 'A'
    as opposed to
    mythingy = 'A'
    but I can't see that it would make a difference to what you are doing here......

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