disconnected data?

Romulo

Member
Joined
Dec 11, 2013
Messages
8
Programming Experience
1-3
When you would use data through a data provider connection,and when would you use disconnected data?
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,144
Location
Sydney, Australia
Programming Experience
10+
When you would use data through a data provider connection,and when would you use disconnected data?
Your question is rather vague. Can you provide more detail and/or provide the motivation for the question?

If you're using ADO.NET, as you should be in a .NET app, then you're always using a connection object from a specific data access provider every time you connect to a database. ADO.NET is designed to work in a disconnected state so that is what you do pretty much all the time. You open a connection only when you need to use it, perform the appropriate operations and then close the connection immediately. If you're editing data then you open a connection, retrieve the data, close the connection, edit the data, open the connection, save the changes and then close the connection again.

The only time that you might say that you're not working in a disconnected state is when you use a data reader and you process the data record by record as you read it. Even then though, you only open the connection when you need to and you close it again straight afterwards.
 
Top Bottom