A
Ash
Hi,
I'm very new to C# and OO, and am currently working on a very simple
solution with two projects in it using VStudio.NET 2003.
The first project in the solution is a Windows Application, and the
Second one is the class Library. The class library contains
constructor, which takes a connection string, and a select statement,
which make the conection, and fill the data adapter.
Assuming my database (using OleDB to Access) has a table called
"Customer" and has fields: "FirstName" and "LastName", here is the
code i have for the constructor on my class library
private string OleDbConnectionString;
private OleDbConnection Connection;
private OleDbDataAdapter DataAdapter;
private DataSet dsCustomers;
// Constructor
public DbClass(string newConnectionString, string SelectCmd)
{
OleDbConnectionString=newConnectionString;
Connection= new OleDbConnection(OleDbConnectionString);
DataAdapter=new OleDbDataAdapter(SelectCmd,Connection);
dsCustomers=new DataSet();
DataAdapter.Fill(dsCustomers, "Customers");
}
..
I understand that after having filled the dataset, it should contain
data from the database. How do i get the data for, lets say, first
row? I need to be able to get that data onto the textbox on the
Windows Application, which is in the same solution.
I will also have to create a next, and previos methods, and am
clueless at the moment.
Would appreciate your help!!
Thanks,
Ash
I'm very new to C# and OO, and am currently working on a very simple
solution with two projects in it using VStudio.NET 2003.
The first project in the solution is a Windows Application, and the
Second one is the class Library. The class library contains
constructor, which takes a connection string, and a select statement,
which make the conection, and fill the data adapter.
Assuming my database (using OleDB to Access) has a table called
"Customer" and has fields: "FirstName" and "LastName", here is the
code i have for the constructor on my class library
private string OleDbConnectionString;
private OleDbConnection Connection;
private OleDbDataAdapter DataAdapter;
private DataSet dsCustomers;
// Constructor
public DbClass(string newConnectionString, string SelectCmd)
{
OleDbConnectionString=newConnectionString;
Connection= new OleDbConnection(OleDbConnectionString);
DataAdapter=new OleDbDataAdapter(SelectCmd,Connection);
dsCustomers=new DataSet();
DataAdapter.Fill(dsCustomers, "Customers");
}
..
I understand that after having filled the dataset, it should contain
data from the database. How do i get the data for, lets say, first
row? I need to be able to get that data onto the textbox on the
Windows Application, which is in the same solution.
I will also have to create a next, and previos methods, and am
clueless at the moment.
Would appreciate your help!!
Thanks,
Ash