L
Lasse Edsvik
Hello
I get the following error:
Fill: SelectCommand.Connection property has not been initialized.
what's wrong? connection works but it refuses to fill the dataset.
using System.Data;
using System.Data.OleDb;
/*
CODE.......
*/
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=c:\db.mdb";
try
{
conn.Open();
OleDbDataAdapter DA = new OleDbDataAdapter();
OleDbCommand SQL = new OleDbCommand("SELECT * FROM Products");
DataSet DS = new DataSet();
DA.SelectCommand = SQL;
DA.Fill(DS,"Products");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
I get the following error:
Fill: SelectCommand.Connection property has not been initialized.
what's wrong? connection works but it refuses to fill the dataset.
using System.Data;
using System.Data.OleDb;
/*
CODE.......
*/
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=c:\db.mdb";
try
{
conn.Open();
OleDbDataAdapter DA = new OleDbDataAdapter();
OleDbCommand SQL = new OleDbCommand("SELECT * FROM Products");
DataSet DS = new DataSet();
DA.SelectCommand = SQL;
DA.Fill(DS,"Products");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}