G
Guest
Hi,
I tried to use DataAdapter to access an .sdf file (SQL Mobile Database File).
This is the Code
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data.SqlServerCe;
DataTable dt = new DataTable();
SqlCeConnection Conn = new
SqlCeConnection("DataSource=\\ProgramFiles\\DbTest\\ssss.sdf");
Conn.Open();
SqlCeCommand sqlCmd = Conn.CreateCommand();
sqlCmd.CommandText = "Select * from MembershipData";
SqlCeDataAdapter da = new SqlCeDataAdapter("SELECT * FROM Users", Conn);
da.Fill(dt);
VS2005 Gave me the following errors.
Error 1: The type 'System.Data.Common.DbDataAdapter' is defined in an
assembly that is not referenced. You must add a reference to assembly
'System.Data.Common, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=969db8053d3322ac, Retargetable=Yes'.
Error 2: 'System.Data.SqlServerCe.SqlCeDataAdapter' does not contain a
definition for 'Fill'
Can some one tell me what is the problem with my code.
I tried to use DataAdapter to access an .sdf file (SQL Mobile Database File).
This is the Code
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data.SqlServerCe;
DataTable dt = new DataTable();
SqlCeConnection Conn = new
SqlCeConnection("DataSource=\\ProgramFiles\\DbTest\\ssss.sdf");
Conn.Open();
SqlCeCommand sqlCmd = Conn.CreateCommand();
sqlCmd.CommandText = "Select * from MembershipData";
SqlCeDataAdapter da = new SqlCeDataAdapter("SELECT * FROM Users", Conn);
da.Fill(dt);
VS2005 Gave me the following errors.
Error 1: The type 'System.Data.Common.DbDataAdapter' is defined in an
assembly that is not referenced. You must add a reference to assembly
'System.Data.Common, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=969db8053d3322ac, Retargetable=Yes'.
Error 2: 'System.Data.SqlServerCe.SqlCeDataAdapter' does not contain a
definition for 'Fill'
Can some one tell me what is the problem with my code.