要不 俺就要死了~~~~
 
										
					
	 
										
					
	 2006-05-17 16:11
	    2006-05-17 16:11
   2006-05-17 17:20
	    2006-05-17 17:20
   2006-05-23 19:30
	    2006-05-23 19:30
   2006-05-24 09:02
	    2006-05-24 09:02
  static void Main() 
  {
   Application.Run(new Form1());
  }
  private void label1_Click(object sender, System.EventArgs e)
  {
  
  }
  private void button1_Click(object sender, System.EventArgs e)
  {
   switch(comboBox1.SelectedIndex)
   {
    case 0:
     if(textBox1.Text==""||textBox2.Text=="")
     {
      MessageBox.Show("用户名和密码不能为空","提示",MessageBoxButtons.RetryCancel,MessageBoxIcon.Information);
      return;
     }
     else
     {
      try
      {
       OleDbConnection conn=db.createdb();
       conn.Open();
       OleDbCommand cmd=new OleDbCommand("select count(*) from user_info where user_id='"+textBox1.Text+"'and user_pwd='"+textBox2.Text+"'and beizhu='1'",conn);
       int count=Convert.ToInt32(cmd.ExecuteScalar().ToString());
       if(count>0)
       {
        Form2 form=new Form2();
        form.Show();
        this.Hide();
       }
      }
      catch(Exception ex)
      {
       MessageBox.Show("错误"+ex.ToString(),"错误");
      }
      
     }
     break;
    case 1:
     if(textBox1.Text==""||textBox2.Text=="")
     {
      MessageBox.Show("用户名和密码不能为空","提示",MessageBoxButtons.RetryCancel,MessageBoxIcon.Information);
      return;
     }
     else
     {
      try
      {
       OleDbConnection conn=db.createdb();
       conn.Open();
       OleDbCommand cmd=new OleDbCommand("select count(*) from user_info where user_id='"+textBox1.Text+"'and user_pwd='"+textBox2.Text+"'and beizhu='0'",conn);
       int count=Convert.ToInt32(cmd.ExecuteScalar().ToString());
       if(count>0)
       {
        main form=new main();
        form.Show();
        this.Hide();
       }
      }
      catch(Exception ex)
      {
       MessageBox.Show("错误"+ex.ToString(),"错误");
      }
      
     }
     break;
    default:
     break;
   }
   

 2006-05-24 19:08
	    2006-05-24 19:08
   2006-06-14 09:20
	    2006-06-14 09:20
   2006-06-14 11:44
	    2006-06-14 11:44
  呵呵,我以前有Delphi做过个,和5楼的差不多(我的意思是编程思路),我想看一下ADO方面的书上肯定有的,或者编程实例的书的我想也会有的!

 2006-06-17 16:44
	    2006-06-17 16:44
   2011-05-04 09:47
	    2011-05-04 09:47
   程序代码:
程序代码: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 money
{
    public partial class Frm_Login : Form
    {
        public Frm_Login()
        {
            InitializeComponent();
            this.Closing += new CancelEventHandler(FormMain_Closing);
         
        }
        void FormMain_Closing(object sender, CancelEventArgs e)
        {
            DialogResult dr = MessageBox.Show("确定退出系统吗?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
            if (dr == DialogResult.OK)
            {
                //
                //在这里请处理相关事务,比如保存等
                //
                Application.Exit();
            }
            else
            {
                e.Cancel = true;
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        private void button1_Click(object sender, EventArgs e)
        {
           string strconn = "provider=microsoft.jet.oledb.4.0;data source=./财务软件.mdb";
           OleDbConnection conn = new OleDbConnection(strconn);           
            string strcmd = "select * from users where name='" + tb1.Text.Trim() + "'and pwd='" + tb2.Text.Trim() + "' ";
            OleDbCommand cmd = new OleDbCommand(strcmd, conn);
            OleDbDataReader reader = cmd.ExecuteReader();
            try
            {
                reader.Read();
                if (reader.HasRows)
                {
                    string pp = tb1.Text;
                   
                    Frm_Main newfrm = new Frm_Main(pp);
                  
                  
                    this.Hide();
                    newfrm.Show();
                    
                }
                else
                {
                    MessageBox.Show("用户密码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tb1.Text = "";
                    tb2.Text = "";
                    tb1.Focus();
                }
            }
            finally
            {
                if (reader != null)
                    conn.Close();
            }
           
          
        }
    }
}
这个适合不?刚好我做用这个数据库										
					
	 2011-05-05 17:33
	    2011-05-05 17:33