源代码如下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;namespace 宾馆客房管理系统
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
if (IsUserIdentify() == true)
{
Form2 form1 = new Form2();
form1.Show();
this.Visible = false;
}
else
{ MessageBox.Show("用户名或密码错误");
} } private bool IsUserIdentify()
{ SqlConnection Conn = new SqlConnection("Data Source=.;Initial Catalog=客房管理系统;Integrated Security=True");
Conn.Open(); string sql = "SELECT Name,PassWord FROM Admin WHERE Name='" + this.textBox1.Text + "'and PassWord='" + this.textBox2.Text + "'";
SqlCommand Cmd = new SqlCommand(sql, Conn);
SqlDataReader reader = Cmd.ExecuteReader(); if (reader.Read())
{
return true;
}
else
{
return false;
}
Conn.Close();
} private void label1_Click(object sender, EventArgs e)
{ } private void Form1_Load(object sender, EventArgs e)
{ }
}
}
大神帮忙,小弟不胜感激
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;namespace 宾馆客房管理系统
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
if (IsUserIdentify() == true)
{
Form2 form1 = new Form2();
form1.Show();
this.Visible = false;
}
else
{ MessageBox.Show("用户名或密码错误");
} } private bool IsUserIdentify()
{ SqlConnection Conn = new SqlConnection("Data Source=.;Initial Catalog=客房管理系统;Integrated Security=True");
Conn.Open(); string sql = "SELECT Name,PassWord FROM Admin WHERE Name='" + this.textBox1.Text + "'and PassWord='" + this.textBox2.Text + "'";
SqlCommand Cmd = new SqlCommand(sql, Conn);
SqlDataReader reader = Cmd.ExecuteReader(); if (reader.Read())
{
return true;
}
else
{
return false;
}
Conn.Close();
} private void label1_Click(object sender, EventArgs e)
{ } private void Form1_Load(object sender, EventArgs e)
{ }
}
}
大神帮忙,小弟不胜感激
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货