110,538
社区成员
发帖
与我相关
我的任务
分享
private void 关于ToolStripMenuItem1_Click(object sender, EventArgs e)
{
Ope f2 = new Ope();
f2.Show();
}
public SqlConnection scn;
//Data Source=.\sqlexpress;Initial Catalog=test;Integrated Security=True
public string connectionstring = @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\bxs\Desktop\图书管理系统_1\图书管理系统_1\bin\Debugtest.mdf;Integrated Security=True;User Instance=False";
public SqlCommand cmd;
public DataSet ds;
public SqlDataAdapter sda;
//构造函数
public Form1()
{
InitializeComponent();
scn = new SqlConnection(connectionstring);
try
{
scn.Open();
}
catch (Exception ex)
{
MessageBox.Show("数据库连接失败!");
}
cmd = scn.CreateCommand();
ds = new DataSet();
sda = new SqlDataAdapter();
}
Database=数据库名称;Server=数据库服务器ip;Uid=sa;Pwd=sa的登录密码;