// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET private void DataBindingFeatures_Load(object sender, EventArgs e) { // The path to the documents directory. string dataDir = Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Creating Select query to fetch data from database string query = "SELECT * FROM Products ORDER BY ProductID"; // Creating connection string to connect with database string conStr = @"Provider=microsoft.jet.oledb.4.0;Data Source=" + dataDir + "dbDatabase.mdb"; // Creating OleDbDataAdapter object that will be responsible to open/close connections with database, fetch data and fill DataSet with data adapter = new OleDbDataAdapter(query, conStr); // Setting MissingSchemaAction to AddWithKey for getting necesssary primary key information of the tables adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; /* * Creating OleDbCommandBuilder object to create insert/delete SQL commmands * automatically that are used by OleDbDatAdapter object for updating * changes to the database */ cb = new OleDbCommandBuilder(adapter); // Creating DataSet object ds = new DataSet(); // Filling DataSet with data fetched by OleDbDataAdapter object adapter.Fill(ds, "Products"); }