您的位置:首页 > 编程语言 > VB

[VB.NET]登录代码调试问题

2008-12-27 22:57 435 查看



<script type="text/javascript"><!--
google_ad_client = "pub-8333940862668978";
/* 728x90, 创建于 08-11-30 */
google_ad_slot = "4485230109";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

登录代码调试问题
未处理的“System.MissingMemberException”类型的异常出现在 microsoft.visualbasic.dll 中。

其他信息: 未找到类型“String”的公共成员“Value”。

Dim strSQL As String
Dim cn As New SqlClient.SqlConnection
Dim rs As New DataSet
cn.ConnectionString = "server=COMPUTER;Database=NEW;uid=sa;Password=; "
cn.Open()
strSQL = "select 密码 from 登录 where 用户名= '' " & 用户登录_Renamed.Text & " '' "
Dim da As New SqlClient.SqlDataAdapter(strSQL, cn)
Dim count As Int32 = da.Fill(rs)
If count = 0 Then
MsgBox( "用户名不正确 ")
Else
If rs.Tables(0).Rows(0)(0).Value = Text1.Text Then
MsgBox( "登录成功 ")
Else
MsgBox( "密码错误 ")
End If
End If

调试后
If rs.Tables(0).Rows(0)(0).Value = Text1.Text Then

这行是黄字显示
__________________________________________________________________________

你 将 rs.tables()这种方式改为
Rs!字段名 这样方式看看!我在vb6里就这么干的

※SET 奥特曼生命上限值=↑↑↓↓←→←→BA 当任何人看到我的回贴时表示该楼主已受到奥特曼共和国零分贴计划的特别保护,任何版主如果擅自删除楼主的贴子将会受到动感死光的惩罚※
__________________________________________________________________________
我不是很懂你说的 能不能具体一些呢,最好给个现成的。

我实在是太菜了!!
__________________________________________________________________________
将Dim count As Int32 = da.Fill(rs)
改为
da.Fill(rs)
Dim count As Int32 = dr.Tables(0).Rows(0)(0).count
__________________________________________________________________________
补通一下
将Dim count As Int32 = da.Fill(rs)
改为
da.Fill(rs)
Dim count As Int32 = rs.Tables(0).Rows(0)(0).count
__________________________________________________________________________
将Dim count As Int32 = da.Fill(rs)
改为
da.Fill(rs)
Dim count As Int32 = dr.Tables(0).Rows.count
__________________________________________________________________________
还是同样的问题 没有解决
__________________________________________________________________________
rs.Tables(0).Rows(0)(0).Value = Text1.Text
这个把.value去掉,用(string)转换下类型
__________________________________________________________________________
我把value 去掉了 运行时 输入密码显示的就是密码错误
__________________________________________________________________________
rs.Tables(0).Rows(0)(0).Value = Text1.Text
这个把.value去掉,用(string)转换下类型

用srting怎么转换类型啊??
__________________________________________________________________________
直接 rs.Tables(0).Rows(0)(0))=text1.text 就可以了!
__________________________________________________________________________

直接 rs.Tables(0).Rows(0)(0))=text1.text 就可以了!

这样不行啊 而且多了个),这样输入密码,显示的就是密码错误,不管输对的错的都是密码错误。
__________________________________________________________________________
rs.Tables(0)(0).ToString
相当于
rs.Tables(0).Item(0).ToString

上面字串的比较是区分大小写的.

......
用dataApdatper.Fill的话,cn.Open可以不用,它会自动open

最好呢,建一个登录的储存过程.返回值中取出错信息.
__________________________________________________________________________
我弄错了.
rs.Tables(0).Rows(0)(0)
相当于
rs.Tables(0).Rows(0).Item(0)
才是.上面漏了Rows
__________________________________________________________________________
我把rs.Tables(0).Rows(0)(0).Value 该成了

rs.Tables(0).Rows(0).Item(0).ToString

但是输入和数据库对应的密码 却显示密码错误

求解决办法
__________________________________________________________________________
rs.Tables(0).Rows(0).Item(0).ToString
__________________________________________________________________________
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息