回复 5楼 名沁
											恩 谢了
  问题 已解决 贴上我的给大家看看~
using System;
using System.Collections.Generic;
using 
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace login
{
    public partial class Form1 : Form
    {
        
        private void Form1_Load(object sender, EventArgs e)
        {
            
        }
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "")
            {
                MessageBox.Show("请输入用户名");
            }
            else
            {
                string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;";
                OleDbConnection myCon = new OleDbConnection(conStr);
                try
                {
                    myCon.Open();
                    //测试连接
                    //
  MessageBox.Show("Success!" + myCon.State.ToString());
                    //使用DataSet
                    string myComStr = "SELECT * FROM Myuser WHERE [姓名]='" + textBox1.Text + " 'and [密码]='" + textBox2.Text + "'";
                    DataSet ds = new DataSet();
                    OleDbDataAdapter myCommand = new OleDbDataAdapter(myComStr, myCon);
                    myCommand.Fill(ds, "Myuser");
                    if (ds.Tables["Myuser"].Rows.Count == 0)
                    {
                        MessageBox.Show(" 密码错误\n" + "请您尽快注册!", "ERROR");
                    }
                    else
                    {
                        MessageBox.Show(textBox1.Text + "登陆成功", "恭喜");
                        return;
                    }
                }
                catch (OleDbException oe)
                {
                    MessageBox.Show(oe.Message);
                }
                finally
                {
                    myCon.Close();
                }
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.textBox1.Text = "";
            this.textBox2.Text = "";
        }
    }
}