K
krunom
I write some application with asp.net (c#) and here is my problem.
This code (with "commented" string line) works well: when i open this page
in Internet Explorer i get in DataGrid2 some data frome my database...
....
....
OleDbConnection OleDbConn = new
OleDbConnection(ConfigurationSettings.AppSettings["connstr"]);
string selectString="SELECT * FROM myTable"
OleDbCommand myOleDbCommand=OleDbConn.CreateCommand();
myOleDbCommand.CommandText=selectString;
OleDbDataAdapter myOleDbDataAdapter = new OleDbDataAdapter();
myOleDbDataAdapter.SelectCommand=myOleDbCommand;
DataSet myDataSet=new DataSet();
myOleDbDataAdapter.Fill(myDataSet);
//string s = (string) myDataSet.Tables["myTable"].Rows[0]["myColumn"];
DataGrid2.DataSource = myDataSet;
DataGrid2.DataBind();
......
......
The problem: if I "uncomment" string line, then i get error message for this
line ("
Object reference not set to an instance of an object") when i try to open
this page in Internet Explorer.
I have in my database table myTable and in this table i have column
myColumn, and in this
column i have surely first row (indexed with "0"), but it doesnt work...why?
please help...Thanks...
This code (with "commented" string line) works well: when i open this page
in Internet Explorer i get in DataGrid2 some data frome my database...
....
....
OleDbConnection OleDbConn = new
OleDbConnection(ConfigurationSettings.AppSettings["connstr"]);
string selectString="SELECT * FROM myTable"
OleDbCommand myOleDbCommand=OleDbConn.CreateCommand();
myOleDbCommand.CommandText=selectString;
OleDbDataAdapter myOleDbDataAdapter = new OleDbDataAdapter();
myOleDbDataAdapter.SelectCommand=myOleDbCommand;
DataSet myDataSet=new DataSet();
myOleDbDataAdapter.Fill(myDataSet);
//string s = (string) myDataSet.Tables["myTable"].Rows[0]["myColumn"];
DataGrid2.DataSource = myDataSet;
DataGrid2.DataBind();
......
......
The problem: if I "uncomment" string line, then i get error message for this
line ("
Object reference not set to an instance of an object") when i try to open
this page in Internet Explorer.
I have in my database table myTable and in this table i have column
myColumn, and in this
column i have surely first row (indexed with "0"), but it doesnt work...why?
please help...Thanks...