请问__Connection的Open函数参数怎么写?
数据库是SQL Server ce2.0 ,数据库名:test.sdf
我这两天也在试这个数据库操作的问题,能否把你实现的方法共享一下!
public static string connectionStr
{
get { return "DataSource=" + WoodDirectory.GetCurPath() + @"\DataBase\Fuxing.sdf"; }
}
private static SqlCeConnection _objConn = null;
public static SqlCeConnection CreateConnection() //创建连接
{
if (_objConn == null)
{
_objConn = new SqlCeConnection("DataSource=" + WoodDirectory.GetCurPath() + @"\DataBase\Fuxing.sdf");
_objConn.Open();
}
else if (_objConn.State != System.Data.ConnectionState.Open)
{
_objConn.Open();
}
return _objConn;
}