连接数据库如下:string connStr = @"server=.\sqlexpress;database=ibtegralSystem;uid=sa;pwd=123";
将bin\Debug 下的 ibtegral.exe ibtegral.mdf ibtegral_log.ldf 添加"应用程序文件夹"里了.
我的数据是用SQL 2005单独建立的,不是在VS2008里建的,
还有我的是窗体界面,不是WEB.急!!没什么打包后,连数据库不错,到底要怎么打包这个数据库!!
将bin\Debug 下的 ibtegral.exe ibtegral.mdf ibtegral_log.ldf 添加"应用程序文件夹"里了.
我的数据是用SQL 2005单独建立的,不是在VS2008里建的,
还有我的是窗体界面,不是WEB.急!!没什么打包后,连数据库不错,到底要怎么打包这个数据库!!
SqlConnection cn = new SqlConnection("Data Source='" + this.Server.Text + "'; "+
"Initial Catalog='" + this.DB.Text + "'; "+
"User id='" + this.ServerUserID.Text +"'; "+
"Password='" + this.SAPsw.Text + "';persist Security Info=False;");
try
{
cn.Open();
Cls_UTILITY.displayMessage("测试连接成功",MessageBoxIcon.Information);
cn.Close();
}
catch (Exception E1)
{
Cls_UTILITY.displayMessage("测试连接失败,原因是:\n" + E1.Message, MessageBoxIcon.Information);
}
cn.Close();
string connStr = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\ibtegralSystem.mdf;Inte" +"grated Security=True;User Instance=True";
conn = new SqlConnection(connStr);