各位大虾:
我的是数据库名字为test.sdf里面有一个user表,但是在SqlCeDataReader dr = cmd.ExecuteReader();时出现异常
程序如下:
string constr="Data Source="+Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)+"\\test.sdf";
SqlCeConnection conn=new SqlCeConnection(constr);
conn.Open();
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "select * from user";
cmd.CommandType = CommandType.Text;
SqlCeDataReader dr = cmd.ExecuteReader();
dr.Close();
conn.Close();
异常描述为:
未处理 System.Data.SqlServerCe.SqlCeException
Message=" [ 1,15,user ]"
HResult=-2147217900
NativeError=25501
Source="SQL Server 2005 Mobile Edition ADO.NET Data Provider"
StackTrace:
at System.Data.SqlServerCe.SqlCeCommand.ProcessResults()
at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteReader()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteReader()
at pocketpc_1.Form1.databind()
at pocketpc_1.Form1.Form1_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at pocketpc_1.Program.Main()
希望各位大虾能帮帮我