public static string connectionstring = @"Data Source=(local);Initial Catalog=book2015;Integrated Security=True";
数据在我电脑上,用的SQL2012,如果我想把数据和用VS2013做好的数据库软件发给别人,还要保证能够连接数据库,我该怎么修改代码?数据库应该放到什么位置?
补充:
定义了一个类
class Dbhelper
{
public static string connectionstring = @"Data Source=(local);Initial Catalog=book2015;Integrated Security=True";
public static SqlConnection connection = new SqlConnection(connectionstring);
}
然后在登录判断时用了这样的代码来打开数据库
SqlCommand command = new SqlCommand(sql, Dbhelper.connection);
// 打开数据库连接
Dbhelper.connection.Open();
,现在需要怎么改才能编程相对路径。
这样啊,谢谢~