日期:2014-05-17 浏览次数:20731 次
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 LibraryMIS
{
public partial class frmLogin : Form
{
private SqlConnection myCon = null;
public frmLogin()
{
InitializeComponent();
this.myCon = new SqlConnection(LibraryMIS.database.dbConnection.connection);
}
private void btOk_Click(object sender, EventArgs e)
{
if (txtName.Text.Trim() == "" || txtPassword.Text.Trim() == "")
MessageBox.Show("请输入用户名和密码", "提示");
else
{
myCon.Open();
SqlCommand cmd = new SqlCommand("", myCon);
if (rdoManage.Checked == true)
{
string sql = "select * from tb_Manager where MName='" + txtName.Text.Trim() + "' and MCode='" + txtPassword.Text.Trim() + "'";
cmd.CommandText = sql;
if ( cmd.ExecuteScalar() != null)
{
//隐藏登录窗口
this.Visible = false;
&nb