首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

无法打开登录所请求的数据库 "DepartmentStore"登录失败。该怎么处理

2012-03-24 
无法打开登录所请求的数据库 DepartmentStore。登录失败。string msg string ConnStringConnString

无法打开登录所请求的数据库 "DepartmentStore"。登录失败。
string msg = "";
  string ConnString;
  ConnString = @"Data Source=(local);Initial Catalog=DepartmentStore;Integrated Security=true;";
  SqlConnection coon = new SqlConnection(ConnString);
  coon.Open();
  string selectCmd = "select * from Admin where adminId='" + textBox1.Text + "'and password='" + textBox2.Text + "'";
  SqlCommand cmd = new SqlCommand(selectCmd, coon);
  SqlDataReader dr = cmd.ExecuteReader();
  if (dr.Read())
  {
  system f1 = new system();
  f1.Show();
  }
  else
  {
  msg = "【账号】或【密码】错误,请重新输入!";
  MessageBox.Show(msg, "登录失败");
  }
  coon.Close();
  dr.Close();

[解决办法]
楼主的链接字符串都没有用户名和密码怎么登陆?
菜鸟路过,说错别怪。嘻嘻

热点排行