private void button1_Click(object sender, EventArgs e)
{
string connstr = "Data Source=.;Initial Catalog=图书管理系统;Integrated Security=True";
SqlConnection conn = new SqlConnection(connstr);
conn.Open();
string select = "select * form 管理员登陆表 where 账号='" + 账号.Text + "'and 密码 = '" + 密码.Text + "'"; this.Hide();
Form4 a = new Form4();
a.Show();
{
string connstr = "Data Source=.;Initial Catalog=图书管理系统;Integrated Security=True";
SqlConnection conn = new SqlConnection(connstr);
conn.Open();
string select = "select * form 管理员登陆表 where 账号='" + 账号.Text + "'and 密码 = '" + 密码.Text + "'"; this.Hide();
Form4 a = new Form4();
a.Show();
解决方案 »
- gridview 分页问题
- 高分高难:使用反射时出现"对象类型无法转换为目标类型"
- 运行C#项目(不是ASP.NET项目),出现提示:试图运行项目时出错:无法启动调试。进程已经终止。
- 如何防止xml文件同时被多个用户访问
- 关于C#中的委托的学习笔记,请高人批改
- 在线等啊,谁知道这个是什么错误不哟??
- 串口,并口
- C#使用itextsharp.dll操作PDF
- 跪求。。。寻找c#视频编码和解码器源代码-----满分送出----高手请进--在线等待!
- C#应程序第一次启动拍照功能可行,关闭重新打开程序就无法启动视频设备
- 类型转换
- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN 导致javascript 不执行
{
string connstr = "Data Source=.;Initial Catalog=图书管理系统;Integrated Security=True";
SqlConnection conn = new SqlConnection(connstr);
try
{
conn.Open();
string select = "select * form 管理员登陆表 where 账号='" + 账号.Text + "'and 密码 = '" + 密码.Text + "'"; this.Hide();
Form4 a = new Form4();
a.Show();
}
catch(Exception ex)
{
throw ex;
}
{
string connstr = "Data Source=.;Initial Catalog=图书管理系统;Integrated Security=True";
string select = "select * form 管理员登陆表 where 账号='" + 账号.Text + "'and 密码 = '" + 密码.Text + "'";
SqlConnection conn = new SqlConnection(connstr);
SqlCommand cmd=new SqlCommand(select ,con);
try
{
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
this.Hide();
Form4 a = new Form4();
a.Show();
}
catch(Exception ex)
{
throw ex;
conn.Close();
}
private void button1_Click(object sender, EventArgs e)
{
string connstr = "Data Source=.;Initial Catalog=图书管理系统;Integrated Security=True";
SqlConnection conn = new SqlConnection(connstr);
try
{
conn.Open();
string select = "select Count(*) form 管理员登陆表 where 账号='" + 账号.Text + "'and 密码 = '" + 密码.Text + "'"; SqlCommand cmd = new SqlCommand(select,conn);
if(cmd.ExecuteScalar()==1)
{
this.Hide();
Form4 a = new Form4();
a.Show();
}
else
{
MessageBox.Show("用户名或密码输入错误");
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
{
..... //statement1. 你的程序过程.
}
catch (Exception ex) //在try{}范围里出现异常的话直接跳到这里.<捕捉异常过程>
{
MessageBox.Show(ex.ToString());
}