标题:ACCESS数据库 急!!!
只看楼主
zhangwei2437
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-4-29
 问题点数:0 回复次数:2 
ACCESS数据库 急!!!
try
            {
                OleDbConnection thisConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=I:\C#\学生管理系统\student\student\db\student.mdb");
                thisConnection.Open();
                string sqlString = "SELECT   *   from   user";
                OleDbCommand cmd = new OleDbCommand(sqlString, thisConnection);
                OleDbDataReader thisReader = cmd.ExecuteReader();
                while (thisReader.Read())
                {
                    if ((name == thisReader["usename"]) && (pwd == thisReader["password"]))
                    {
                        this.Hide();
                        new main().Show();
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码错误,请重新输入!");
                        textBox1.Clear();
                        textBox2.Clear();
                    }
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message.ToString());
            }

里面哪里错了呀?
搜索更多相关主题的帖子: 数据库 ACCESS 
2008-04-19 20:45
oldbabyxixi
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2007-9-16
得分:0 
你试试把string sqlString = "SELECT   *   from   user";
改成string sqlString = "SELECT   *   from   [user]";
2008-04-20 22:33
zhangwei2437
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-4-29
得分:0 
已解决
原来是USER是C#的关键字
2008-04-21 10:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-209969-1-1.html




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

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