none
MSSQL server and C# RRS feed

  • Question

  • Hi. How I can take online data updates from my MSSQL Server 2000 to C#(Visual Studio 2005)? Can I do it without transactions? And updates on timer? Can I do it in stream?

    Information In server can change several times in several tables within one second.... How I can synchronize it with C#? And how I can do these updates in max short time and with minimal computer recourses. Information must be updated without blinking.

     

    Ps. Sorry for my English.

     

    Wednesday, February 20, 2008 2:52 PM

Answers

  • Using transactions is NOT necessary as all discrete operations are executed as transactions.

    As I discuss in my book, updates can be done in a variety of ways but most of the time will be consumed dealing with collisions. That is, when program (user) A attempts to change data that was changed by program B. You need to design-in a strategy that either prevents this from happening or create mechanisms to detect the collisions quickly and deal with them without involving the user (ideally).

     

    Speedy updates are really a function of how many round-trips to the server it takes to execute them, how much the indexes get in the way, and whether or not there are triggers or other validation constraints that slow things down (among other things).

     

    If you have a lot of data to post to the SQL Server, using UPDATE is the slowest possible way. I recommend using SqlBulkCopy to import data.

     

    This answer has nothing to do with C#. It's simply the language you use to build your applications. VB.NET or other .NET languages work the same way.

     

     

    Thursday, May 29, 2008 7:47 PM
    Moderator

All replies

  • You can use transactions to do this. And to avoid data corruption, it is good to use transactions.

     

    For more information, you could visit http://msdn.microsoft.com/en-us/library/w97s6fw4(VS.80).aspx

    Thursday, May 29, 2008 8:23 AM
  • Using transactions is NOT necessary as all discrete operations are executed as transactions.

    As I discuss in my book, updates can be done in a variety of ways but most of the time will be consumed dealing with collisions. That is, when program (user) A attempts to change data that was changed by program B. You need to design-in a strategy that either prevents this from happening or create mechanisms to detect the collisions quickly and deal with them without involving the user (ideally).

     

    Speedy updates are really a function of how many round-trips to the server it takes to execute them, how much the indexes get in the way, and whether or not there are triggers or other validation constraints that slow things down (among other things).

     

    If you have a lot of data to post to the SQL Server, using UPDATE is the slowest possible way. I recommend using SqlBulkCopy to import data.

     

    This answer has nothing to do with C#. It's simply the language you use to build your applications. VB.NET or other .NET languages work the same way.

     

     

    Thursday, May 29, 2008 7:47 PM
    Moderator