应该用这样的格式吧Data Source=.\SQLEXPRESS;AttachDbFileName=e:\data\Customers.mdf;Integrated Security=True;User Instance=True
解决方案 »
- 关于C#调用斑马打印机打印图像问题请教
- treelist的checkedit列格式怎么控制
- 使用WCF访问oracle是不是每次都要建立OracleConnection
- winform 写入txt
- 数据绑定并更新问题(求助)
- picturebox中如何获得当前鼠标所指的点的RGB值
- 如何在多个类之间传递对象,类似于TreeView ,TreeNodeCollection,TreeNode
- 关于SqlDataReader 类读取数据
- 开始C#的学习不久,想请教一下有关参考书的问题
- C#输出输入语句
- 请问如何用C#调用C的函数,该函数有个参数是char**
- 求教:利用C# WinForm 进度条来反映程序执行的状态
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices; public class Configs
{
private string m_CurrentPath; private string Platform
{
get
{
return Environment.OSVersion.Platform.ToString();
}
} public string CurrentPath
{
get
{ if (Platform.Equals("WinCE"))
{
m_CurrentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
}
else if (Platform.Equals("Win32NT"))
{
m_CurrentPath = Directory.GetCurrentDirectory();
} return m_CurrentPath;
}
} public Configs()
{ }
}
用这个类获得你数据文件的位置,然后用
SqlCeConnection conn = new SqlCeConnection("Data Source = " + MyPath.CurrentPath.ToString() + "\\MyNotes.sdf;");