数据库信息

代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace DateBasevis1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void theSign_Click(object sender, EventArgs e)
{
string strcon = @"server = LAPTOP-4JLI4OAI; database = students; integrated security = True";
SqlConnection conn = new SqlConnection(strcon);
conn.Open();
if (conn.State == ConnectionState.Open)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select users_id,pwd from users where name='" + theUsrs.Text + "'" + "and pwd='" + thePwd.Text+"'";
//MessageBox.Show("select users_id,pwd from users where name='" + theUsrs.Text + "'" + "and pwd='" + thePwd.Text + "'");
SqlDataReader sqlread = cmd.ExecuteReader();
if (sqlread.Read())
{
MessageBox.Show("登录成功!");
this.Visible = false;
Form1 mForm = new Form1();
mForm.Show();
}
else
{
MessageBox.Show("登录失败");
}
}
}
}
}