S
SarahP
Hello,
I am connecting to an SQL CE DB during the form load. If the following
code executes after the form is loaded from, a button click let's say,
everything is fine and the dataGrid populates as expected. However, if
I call the exact same code after the connection to the database, in the
form load, the result set and consequently the dataGrid are empty. The
column names are present, so it is connected to the database, and
finding the appropriate table, but for some reason it thinks there are
no records. Can anyone help?
The code is: (I'm writing in C# by the way): (and also conn = the
SqlCeConnection)
DataGrid1.DataSource = new SqlCeCommand("select Table2.ID, Table1.DESCR
from Table2 join Table1 on Table2.ID1 = Table1.ID",
conn).ExecuteResultSet(ResultSetOptions.Insensitive |
ResultSetOptions.Scrollable);
To repeat, there are results when done on a button click, and an empty
table if called during the form load, after the Db connection.
I am connecting to an SQL CE DB during the form load. If the following
code executes after the form is loaded from, a button click let's say,
everything is fine and the dataGrid populates as expected. However, if
I call the exact same code after the connection to the database, in the
form load, the result set and consequently the dataGrid are empty. The
column names are present, so it is connected to the database, and
finding the appropriate table, but for some reason it thinks there are
no records. Can anyone help?
The code is: (I'm writing in C# by the way): (and also conn = the
SqlCeConnection)
DataGrid1.DataSource = new SqlCeCommand("select Table2.ID, Table1.DESCR
from Table2 join Table1 on Table2.ID1 = Table1.ID",
conn).ExecuteResultSet(ResultSetOptions.Insensitive |
ResultSetOptions.Scrollable);
To repeat, there are results when done on a button click, and an empty
table if called during the form load, after the Db connection.