| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2490 人关注过本帖
标题:求C#和Access的登陆界面程序
只看楼主 加入收藏
雨过无声
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-5-17
收藏
 问题点数:0 回复次数:9 
求C#和Access的登陆界面程序
俺是个超级新手,希望大家拉我一把
要不 俺就要死了~~~~
搜索更多相关主题的帖子: Access 界面 登陆 
2006-05-17 16:11
negat
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2006-5-17
收藏
得分:0 
同情下 我要是在做呢。。。  等做好了跟你分享。。。
2006-05-17 17:20
龙之幻影
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-5-23
收藏
得分:0 
我也是啊  也和我分分
2006-05-23 19:30
leisky
Rank: 1
等 级:新手上路
帖 子:253
专家分:0
注 册:2006-5-22
收藏
得分:0 
呵呵 做好了我也想参考一下..要是哪位高手做好了也发给我一份吧.谢谢 wlei5217@163.com

2006-05-24 09:02
lw817810
Rank: 1
等 级:新手上路
帖 子:79
专家分:7
注 册:2006-4-4
收藏
得分:0 

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
yang0826
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-6-12
收藏
得分:0 
行吗?

2006-06-14 09:20
liubaoen
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:104
专家分:117
注 册:2006-6-12
收藏
得分:0 
看看随便买本书,那上面的示例代码都够你用了
2006-06-14 11:44
xinxinren
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2006-4-14
收藏
得分:0 

呵呵,我以前有Delphi做过个,和5楼的差不多(我的意思是编程思路),我想看一下ADO方面的书上肯定有的,或者编程实例的书的我想也会有的!


雨纷飞 飞在天空里是我的眼泪 泪低垂 垂在手心里是你的余味
2006-06-17 16:44
ghbjimmy
Rank: 2
等 级:论坛游民
帖 子:49
专家分:19
注 册:2010-5-17
收藏
得分:0 
我也想捡个现成的,但是很多东西还是要自己去摸索!
2011-05-04 09:47
here20082001
Rank: 2
等 级:论坛游民
帖 子:28
专家分:18
注 册:2011-3-21
收藏
得分:0 
程序代码:
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
快速回复:求C#和Access的登陆界面程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018740 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved