在本机上用模拟器运行程序时发生错误报“路径无效。请检查数据库的目录”。
symbol.sdf在程序的目录下
打开数据库的方法如下:
public void opensql()
{
//SqlCommand cm = new System.Data.SqlClient.SqlCommand();
//SqlConnection cn = new SqlConnection();
SqlCeCommand cm = new SqlCeCommand();
SqlCeConnection cn = new SqlCeConnection();
//cn.ConnectionString = "Data Source=symbol.sdf";
//cn.ConnectionString = "server=JC91109;uid=sa;pwd=sa;database=symbol";
cn.ConnectionString = "data source=symbol.sdf";
cn.Open();
cm.Connection = cn;
}