Программирование в IIS



Пример 2.10


private void LoadGrid(DataGrid dg) { //set the connection credentials string DataSetName = "myChairs"; string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\\aspData\\employees.mdb;";

//make the DB connection OleDbConnection myConn = new OleDbConnection(ConnectionString);

//make a data set to hold chairs DataSet myDataSet = new DataSet(DataSetName);

//make a data adaptor OleDbDataAdapter myAdapt = new OleDbDataAdapter("Select * From tblChair", myConn);

//fill the dataset myAdapt.Fill(myDataSet);

//get a view in the dataset DataView myDataView = new DataView(myDataSet.Tables[0]);

//show the data view in the Grid dg.DataSource = myDataView; dg.DataBind(); }

Листинг 2.10. Source Code for Subroutine LoadGrid

Закрыть окно






Содержание  Назад  Вперед