Loading Data Tables in C#

  • Thread starter Thread starter RG
  • Start date Start date
R

RG

Is there an easy way to load c# data tables with sql data using recordsets
thereby avoiding using ado classes?

In a web application, can there be 1) one instance of a particular data
table connected to a specific database/table att all times and have all web
clients a view to that data? 2) How to make contents of c# data table
synchronized with that of the database table ?

Is there a way to lock db tables between web responses?

Any help and/or sample code is appreciated.

Thanks in advance
 
Is there an easy way to load c# data tables with sql data using
recordsets thereby avoiding using ado classes?

ADO Recordsets? Sure, but it is unwise, as you end up with a lot of
interop, which is asking for problems. You can, however, use
CreateObject and use old ADO, if you must. I have yet to see a good
reason, other than familiarity (which is not a good reason).

As for loading a table into an app, it is quite easy with ADO.NET. One
easy way is to use a strongly typed DataSet. LINQ to SQL, with the
designer, is also easy. And Entity Framework is not much harder.
In a web application, can there be 1) one instance of a particular
data table connected to a specific database/table att all times and
have all web clients a view to that data? 2) How to make contents of
c# data table synchronized with that of the database table ?

Do you mean you want a client to update when changes are made? If so,
you can set the application up to inform the user. AJAX is easiest for
this.

This, however, is not normal, as web apps are disconnected. The more
normal method is optimistically locked data and informing user when
conflicts occur (concurrency errors).
Is there a way to lock db tables between web responses?

Yes, but this IS NOT A GOOD IDEA. If the user shuts down his browser,
the data is locked until session time out. Ouch!

Handling concurrency errors is better for a web app. Now, you can make
it so the update is through a smart client and lock. You can easily
clean up the lock if the user exits the app.

As for sample code, there are plenty of code samples on binding data and
roundtripping. With web apps, you will not find many table locking
examples, as it is not wise. Hope this helps!


Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top