M
Mike B
I am just starting a project that will use a SQL Server Compact db on the
desktop. I am trying to write my data access classes and getting an odd
error.
This code:
Sub BindGridCE_Fails()
Dim cx As SqlCeConnection
Try
cx = New SqlCeConnection("Data Source = croe2db.sdf")
cx.Open()
Dim cm As SqlCeCommand = cx.CreateCommand()
cm.CommandText = "select * from MyTable2"
' ERROR OCCURS ON NEXT LINE
Dim rs As SqlCeResultSet =
cm.ExecuteResultSet(ResultSetOptions.Updatable Or
ResultSetOptions.Scrollable)
Me.DataGrid1.DataSource = rs
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Produces the error message: "The specified table does not exist. [
MyTable2 ]"
The table does exist. If I simply drag it to the data grid, it works fine.
If I use the example provided at MSDN:
http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceresultset(VS.80).aspx
With the "Me.DataGrid1.DataSource = rs" line added, the dataGrid binding
works. So I doubt that is the issue. But, when is the ResultSet failing when
the table exists? I must be missing something obvious, no?
Also, from the example, the new table is added programmatically and can be
binded to the grid, but
it DOES NOT APPEAR in the dataset.xsd designer. Where is it hiding?
I apologize for the cross-post, but I wasn't sure which group was
appropriate. I posted to teh SQL Server CE group and nobody answered.
Thanks in advance for help.
MB
desktop. I am trying to write my data access classes and getting an odd
error.
This code:
Sub BindGridCE_Fails()
Dim cx As SqlCeConnection
Try
cx = New SqlCeConnection("Data Source = croe2db.sdf")
cx.Open()
Dim cm As SqlCeCommand = cx.CreateCommand()
cm.CommandText = "select * from MyTable2"
' ERROR OCCURS ON NEXT LINE
Dim rs As SqlCeResultSet =
cm.ExecuteResultSet(ResultSetOptions.Updatable Or
ResultSetOptions.Scrollable)
Me.DataGrid1.DataSource = rs
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Produces the error message: "The specified table does not exist. [
MyTable2 ]"
The table does exist. If I simply drag it to the data grid, it works fine.
If I use the example provided at MSDN:
http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceresultset(VS.80).aspx
With the "Me.DataGrid1.DataSource = rs" line added, the dataGrid binding
works. So I doubt that is the issue. But, when is the ResultSet failing when
the table exists? I must be missing something obvious, no?
Also, from the example, the new table is added programmatically and can be
binded to the grid, but
it DOES NOT APPEAR in the dataset.xsd designer. Where is it hiding?
I apologize for the cross-post, but I wasn't sure which group was
appropriate. I posted to teh SQL Server CE group and nobody answered.
Thanks in advance for help.
MB