标题:做的一个简单的登陆页面用的access数据源各位高手帮我看看啊~
只看楼主
damelly
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-1-11
 问题点数:0 回复次数:2 
做的一个简单的登陆页面用的access数据源各位高手帮我看看啊~
Dim connstr As String

        connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("./") & "App_Data/book.mdb"

        Dim myConn As New Data.OleDb.OleDbConnection(connstr)
        Dim ole As String
        ole = "SELECT * FROM [UserInfo]where UserID='" + TextBox1.Text + "' or UserPassWord='" + TextBox2.Text + "' "
        Dim mycmd As New Data.OleDb.OleDbCommand(ole, myConn)
        myConn.Open()


        Dim read As Data.OleDb.OleDbDataReader = mycmd.ExecuteReader()
        If (read.Read()) Then
            If read.GetValue(0).ToString = TextBox1.Text Then
                If read.GetValue(1).ToString = TextBox2.Text Then
                    Response.Redirect("Default2.aspx")
                End If
                Response.Write("密码错误")
            End If
            Response.Write("用户名错误")





        End If


它老说 read As Data.OleDb.OleDbDataReader = mycmd.ExecuteReader()标准表达式中数据类型不匹配
搜索更多相关主题的帖子: 数据源 access Microsoft Data 
2008-01-11 23:52
lxd824
Rank: 1
等 级:新手上路
帖 子:135
专家分:0
注 册:2007-4-21
得分:0 
"SELECT * FROM [UserInfo]where UserID='" + TextBox1.Text + "' or UserPassWord='" + TextBox2.Text + "' "有问题

"SELECT * FROM  [UserInfo] where UserID='" + TextBox1.Text + "' and UserPassWord='" + TextBox2.Text + "' "
在where前面加个空格还有应该是用and不是用or吧!
2008-01-12 19:35



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




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

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