Protected system.web.ui.webcontrols.dataGrid DataGrid1;
Private Void Page_Load (Object Sender, System.EventArgs E)
{
Random rd = new random ();
String dbpath = @ "DATA / DBTEST.MDB";
String DB = Server.mappath (dbpath);
String connectionString = "provider = microsoft.jet.Oledb.4.0; data source =" DB;
String strsql = "SELECT [CUSTOMERID], [Address] from customers";
DataSet DS = New Dataset ();
OLEDBCONNECTION CONN = New OLEDBCONNECTION (Connectionstring);
OLEDBDataAdapter Da = New OLEDBDataAdapter (strsql, conn);
OLEDBCommandbuilder CB = New OLEDBCommandbuilder (DA);
// With the connection link of the database, the parameter 1 starts with the first behavior, the parameter 2 is down two lines.
//da.fill (DS, 1, 2, "testmdb ");
Da.fill (DS, "Testmdb");
/ / Insert a new line to DataSet
DataRow Dr = DS.TABLES ["TestMDB"]. Newrow ();
DR ["Customerid"] = "RandNumber";
DR ["address"] = rd.next (100000) .tostring ();
DS.Tables ["TestMDB"]. Rows.Add (DR); // Fill content to DataSet
Da.UPDATE (DS, "TestMDB");
DataGrid1.datasource = DS.TABLES ["TestMDB"]. DefaultView;
DataGrid1.databind ();
Ds.clear ();
CONN.CLOSE ();
}