If you whant to use CsqlCE you need to use SQLCE objects like this:
if(System.IO.File.Exists(@"\My Documents\TestDB.sdf"))
{
SqlCeConnection oConn = new SqlCeConnection(@"Data Source=\My
Documents\TestDB.sdf");
SqlCeCommand sqlProd;
sqlProd = new SqlCeCommand("SELECT * from tblBook", oConn);
SqlCeDataAdapter daProduct = new SqlCeDataAdapter(sqlProd);
if (daProduct == null)
{
dtsProduct = new DataSet();
}
dtsProduct.Clear();
daProduct.Fill(dtsProduct,"tblBook");
DataGrid1.DataSource = dtsProduct.Tables["tblBook"];
}
____________________
Franky
(e-mail address removed)
Microsoft said:
Yes, I try it, but fail.
My code is like this :
Dim SqlConnection1 As New System.Data.SqlClient.SqlConnection
Dim SqlSelectCommand1 As New System.Data.SqlClient.SqlCommand
Dim SqlDataAdapter1 As New System.Data.SqlClient.SqlDataAdapter
Dim SqlDataSet1 As New System.Data.DataSet
SqlConnection1.ConnectionString = "data source=" &
openFileDialog1.FileName() & ";Password=abc;persist security
info=True;packet size=4096"
SqlDataAdapter1.SelectCommand = SqlSelectCommand1
SqlSelectCommand1.CommandText = "SELECT * from tblBook"
SqlSelectCommand1.Connection = SqlConnection1
SqlConnection1.Open()
SqlDataAdapter1.Fill(SqlDataSet1)
SqlDataAdapter1.TableMappings.Add("tblBook", "strBookFullThai")
SqlDataSet1.Tables("tblBook").Columns("strBookFullThai")