How to select multiple tables by using SqlCeDataAdapter

  • Thread starter Thread starter Kenghot
  • Start date Start date
K

Kenghot

I'm using Compact Framework and SqlCeDataAdapter to get data from
sqlce database

with this code
dim cn = New SqlCeConnection(strCn)
dim ds as new dataset
dim da as New SqlCeDataAdapter("", cn)
cn.open
da.SelectCommand.CommandText = "select * from BarCode;select * from
Country"
da.SelectCommand.CommandType = CommandType
da.Fill(ds)

This use to be work when i run with SqlDataAdapter (Window
application) and this will reture two datatable in ds (dataset) but
when i try with SqlCeDataAdapter (with compact framework) , error
ocurres:

There was an error parsing the query. [ Token line number = 1,Token
line offset = 23,Token in error = select ]
 
Multiple SQL statements are not supported on the CF ADO.NET.

You have to execute them separately. Checkout Steve Laskers LOB Accelerator.
They show an example of running SQL scripts in batches from embedded SQL
resource files.

The only way to select from multiple tables in one SQL statement on the CF
is of course by using joins.
 
Back
Top