private void BindWithoutInSheetHeaders() { //Create dataset object this.dataSet21 = new DataSet2(); //Create demo database DemoDatabase2 db = new DemoDatabase2(); //Create path to database file string path = Server.MapPath("~"); path = path.Substring(0, path.LastIndexOf("\\")); //Create connection to database db.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + "\\Database\\Northwind.mdb"; try { // Connects to database and fetches data. // Customers Table. db.oleDbDataAdapter1.Fill(dataSet21); // Orders Table. db.oleDbDataAdapter2.Fill(dataSet21); // OrderDetailTable. db.oleDbDataAdapter3.Fill(dataSet21); // Filter data //dataSet21.Customers.DefaultView.RowFilter = "CustomerID<'BSAAA'"; //Create web worksheet object WebWorksheet sheet = GridWeb1.WebWorksheets[0]; // Clears the sheet. sheet.Cells.Clear(); // Disables creating in-sheet headers. sheet.EnableCreateBindColumnHeader = false; // Data cells begin from row 0. sheet.BindStartRow = 0; // Bind the sheet to the dataset. sheet.DataSource = dataSet21; sheet.DataBind(); } finally { //Close connection db.oleDbConnection1.Close(); } }
private void BindWithoutInSheetHeaders() { // Create dataset object this.dataSet21 = new DataSet2(); // Create demo database DemoDatabase2 db = new DemoDatabase2(); // Create path to database file string path = (this.Master as Site).GetDataDir(); // Create connection string db.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + "\\Miscellaneous\\Database\\Northwind.mdb"; try { // Connects to database and fetches data. // Customers Table. db.oleDbDataAdapter1.Fill(dataSet21); // Orders Table. db.oleDbDataAdapter2.Fill(dataSet21); // OrderDetailTable. db.oleDbDataAdapter3.Fill(dataSet21); // Create web worksheet object WebWorksheet sheet = GridWeb1.WebWorksheets[0]; // Clears the sheet. sheet.Cells.Clear(); // Disables creating in-sheet headers. sheet.EnableCreateBindColumnHeader = false; // Data cells begin from row 0. sheet.BindStartRow = 0; // Bind the sheet to the dataset. sheet.DataSource = dataSet21; sheet.DataBind(); } finally { //Close connection db.oleDbConnection1.Close(); } }