Click here to Skip to main content
15,921,941 members
Home / Discussions / Database
   

Database

 
GeneralRe: Access and ASP Pin
RichardGrimmer1-Sep-03 5:13
RichardGrimmer1-Sep-03 5:13 
GeneralOleDb Connection Pin
Dan Betting27-Aug-03 10:08
sussDan Betting27-Aug-03 10:08 
GeneralRe: OleDb Connection Pin
andyharman27-Aug-03 10:52
professionalandyharman27-Aug-03 10:52 
GeneralRe: OleDb Connection Pin
Dan Betting27-Aug-03 11:49
sussDan Betting27-Aug-03 11:49 
GeneralRe: OleDb Connection Pin
Bo Hunter27-Aug-03 12:41
Bo Hunter27-Aug-03 12:41 
GeneralRe: OleDb Connection Pin
Chris Blazek30-Aug-03 18:17
sussChris Blazek30-Aug-03 18:17 
GeneralsqlDataAdapter Recommendation Pin
econner27-Aug-03 8:03
econner27-Aug-03 8:03 
GeneralRe: sqlDataAdapter Recommendation Pin
Mike Dimmick28-Aug-03 3:16
Mike Dimmick28-Aug-03 3:16 
A SqlDataAdapter is simply that: an adapter that fits between a DataSet or DataTable and one or more SqlCommands - one to select data, the SelectCommand property, and up to three others to update, insert and delete data (UpdateCommand, InsertCommand and DeleteCommand, respectively).

There are basically two ways to access data in a database with ADO.NET. The simplest, where you just need to fetch a result set from the database and do something with it quickly (e.g. export to a file, display on screen) is to use a SqlDataReader, which you obtain by calling ExecuteReader on the SqlCommand object. If the query you're executing only returns a single value, or you only want the value of the first field in the first row of the result set, consider ExecuteScalar instead. If you don't care about the response at all, or there isn't one, use ExecuteNonQuery.

If you're familiar with classic ADO, a SqlDataReader is similar to a Recordset opened with the adOpenForwardOnly and adLockReadOnly options. You can't reuse the SqlConnection that you executed the command on until you have closed your SqlDataReader or read all the results (when Read returns False).

For more complicated scenarios, where you need to access multiple result sets simultaneously, or you need to execute other queries against the result set, or the user needs to be able to update the data, ADO.NET provides DataSet and DataTable.

DataTable represents a cache of a result set, and offers many of the features from classic ADO, including editing and access to original and modified versions of rows. However, a DataTable is disconnected - any changes made to the DataTable are not reflected in the database until you use the DataAdapter's Update method.

A DataSet is a collection of DataTables and, optionally, relationships (DataRelations) between those tables (for example, parent-child).

Classes listed above which begin with Sql are specific to SQL Server, and live in the System.Data.SqlClient namespace. The other classes (beginning Data) are general and can be used with any provider; they live in the System.Data.

OLE DB equivalents of the Sql classes can be found in the System.Data.OleDb namespace. There are also so-called provider classes for ODBC and Oracle (downloadable from Microsoft for .NET Framework 1.0, and included in 1.1).
GeneralSetFieldNull. Pin
Anonymous26-Aug-03 9:13
Anonymous26-Aug-03 9:13 
GeneralODBC Q Pin
Frank Olorin Rizzi26-Aug-03 7:39
Frank Olorin Rizzi26-Aug-03 7:39 
GeneralRe: ODBC Q Pin
Frank Olorin Rizzi27-Aug-03 4:02
Frank Olorin Rizzi27-Aug-03 4:02 
GeneralRe: ODBC Q Pin
Mike Dimmick27-Aug-03 5:22
Mike Dimmick27-Aug-03 5:22 
GeneralRe: ODBC Q Pin
Frank Olorin Rizzi27-Aug-03 5:57
Frank Olorin Rizzi27-Aug-03 5:57 
GeneralRe: ODBC Q Pin
Mike Dimmick27-Aug-03 6:03
Mike Dimmick27-Aug-03 6:03 
GeneralRe: ODBC Q Pin
Frank Olorin Rizzi27-Aug-03 6:05
Frank Olorin Rizzi27-Aug-03 6:05 
GeneralRe: ODBC Q Pin
Tom Archer28-Aug-03 3:35
Tom Archer28-Aug-03 3:35 
GeneralRe: ODBC Q Pin
Frank Olorin Rizzi28-Aug-03 4:18
Frank Olorin Rizzi28-Aug-03 4:18 
GeneralRe: ODBC Q Pin
Frank Olorin Rizzi28-Aug-03 5:54
Frank Olorin Rizzi28-Aug-03 5:54 
GeneralRe: ODBC Q Pin
Frank Olorin Rizzi9-Sep-03 2:19
Frank Olorin Rizzi9-Sep-03 2:19 
GeneralBULK INSERT via ADO -- URGENT Pin
Anonymous26-Aug-03 5:06
Anonymous26-Aug-03 5:06 
GeneralRe: BULK INSERT via ADO -- URGENT Pin
Anonymous26-Aug-03 5:57
Anonymous26-Aug-03 5:57 
GeneralRe: BULK INSERT via ADO -- URGENT Pin
Mike Dimmick26-Aug-03 22:36
Mike Dimmick26-Aug-03 22:36 
GeneralRe: BULK INSERT via ADO -- URGENT Pin
m2m Inc27-Aug-03 23:32
m2m Inc27-Aug-03 23:32 
GeneralDatareader & Datasets Pin
Nick Seng25-Aug-03 20:15
Nick Seng25-Aug-03 20:15 
GeneralRe: Datareader & Datasets Pin
Hesham Amin25-Aug-03 21:41
Hesham Amin25-Aug-03 21:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.