How to select multiple tables by using SqlCeDataAdapter

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 ]
 
S

Simon Hart [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top