hey i'm going to do same way probably...
i been thinking about using:
sqlcon
sql data adapter
dataset
datagrid
so i think :
fill a dataset with data from the data source, and upddate the data source with any changes made in the dataset.
this.sqlDataAdapter.Fill(this.ds, "Name of Table");
Meanwhile you can add a DataGrid etc....
using commands like delete,insert,select
So basically reading Data with the DataSet looks like:
- fill the dataset with data
- access tables, rows and columns in the dataset
using System;
using System.Data;
using System.Data.SqlClient;
public static void Main()
SqlConnection thisConnection = new SqlConnection
@"DataSource=(local);Integrated Security=SSPI;" + "Initial Catalog=northwing");
SqlDataAdapter thisAdapter = new SqlDataAdapter;
("SELECT CustomerID, ContactName FROM Customers"; thisConnection);
DataSet thisDataSet = new Dataset();
thisAdapter.Fill(thisDataSet, "Customers");
foreach(DataRow theRow in this DataSet.Tables["Customers"].Rows)
{
Console.WriteLine(theRow["CustomersID"] + "\t" + theRow["ContactName"]);
}
|