C#和sql server 2000组合编写的登陆框!

来源:互联网 发布:淘宝交纳保证金在哪里 编辑:程序博客网 时间:2024/06/13 03:50

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Data.SqlClient;


namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {  
            string A=textBox1 .Text ;
            string B=textBox2 .Text ;
            SqlConnection sqlc = new SqlConnection("server=.;uid=sa;pwd=sa;database=pubs");
            sqlc.Open();
            string str = "select * from jobs where min_lvl=" + A + "and max_lvl=" + B;
            SqlCommand C= new SqlCommand(str, sqlc);
            SqlDataReader DR = C.ExecuteReader();
            if (DR.HasRows)
            {
                MessageBox.Show("您登陆成功!");
            }
            else
            {
                MessageBox.Show("您登陆失败!");
            }

            sqlc.Close();

        }
    }
}

原创粉丝点击