C# recordset

  • Thread starter Thread starter C# beginner
  • Start date Start date
C

C# beginner

1. I'm trying to convert a C++ program to C#. In C++, our
code uses several CRecordset derived classes (These
classes are representative of our SQL server tables).
These classes are instantiated and used in many places in
our C++ code. What is the easiest way to represent C++
Recordsets in C#? Will datatables work?

2. I have to read a few SQL server tables (whose data
don't change) and load them in memory. Is it efficient to
use an array or is it efficient to load the data into
datatables using datasets?

thanks very much for your replies.
 
DataTables are pretty much dynamic recordsets.

If you need forward only access to the data, use a SqlDataReader is quite a
bit faster than looping through DataTable.Rows.

DataSet/Table provides alot of functionality for detecting changes to the
data, and updating the source. And can be really easy to implement with a
SqlDataAdapter;

//
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(selectCommandString,
dataBaseConnectionString);
sda.Fill(dt);
//

Hope it helps...
Josh
Microsoft.com Tools
 
Back
Top