Combining multiple SQL Update commands for Access database?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jack daniels via .NET 247

    #1

    Combining multiple SQL Update commands for Access database?

    Hi! Perhaps you know of a better way here.

    I have an Access database, actually a single table. Now, at the click of a button on a C# Form, each and every single cell associated with the primary keys has to be updated. I have the new cell values in an arraylist and this is what I am doing:

    for (int i = 0; i < numberOfPrimary Keys; i++)
    {
    adapter.UpdateC ommand = new OleDbCommand(st rSQL, conn);
    adapter.UpdateC ommand.ExecuteN onQuery();
    }

    "strSQL" has the update command for a row; I am updating the Access database one row-command at a time.

    My God, ONE ROW-COMMAND AT A TIME! Is there a better way, a faster way?

    I read somewhere that I can combine multiple SQL statements by separating them with a semi-colon and putting the whole lot into the "strSQL" string. Apparently, that doesn't work, at least not with an Access database.

    Any and every comment will help. Thanks!

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>0gV1P4Nq+kK MU6MPygvong==</Id>
Working...