PC Review


Reply
Thread Tools Rate Thread

Combining multiple SQL Update commands for Access database?

 
 
jack daniels via .NET 247
Guest
Posts: n/a
 
      31st Mar 2005
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 < numberOfPrimaryKeys; i++)
{
adapter.UpdateCommand = new OleDbCommand(strSQL, conn);
adapter.UpdateCommand.ExecuteNonQuery();
}

"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+kKMU6MPygvong==</Id>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining multiple Update Queries KittyKathy Microsoft Access Getting Started 3 13th Jun 2007 08:31 AM
Is there any way to run multiple SQL commands in Access 2003 =?Utf-8?B?Um9k?= Microsoft Access 2 7th Jun 2006 07:06 PM
Modify Access menu commands when no database running. =?Utf-8?B?RHdhcmZtYWdl?= Microsoft Access VBA Modules 11 27th Jul 2005 08:07 PM
3 table Access Database using vb.Net Problems with UPDATE and INSERT commands jay B via DotNetMonster.com Microsoft ADO .NET 1 11th Jun 2005 02:10 PM
Multiple update commands in one statment? Doug Swanson Microsoft Access ADP SQL Server 3 23rd Jan 2004 03:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:38 PM.