使用visual basic和access登录系统 [英] log in system with visual basic and access

查看:69
本文介绍了使用visual basic和access登录系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想问。

任何人都可以为我更正此代码吗?

hello i would like to ask.
can anyone correct this code for me??

cm.CommandText = "SELECT * FROM Table1 WHERE uname='" & TextBox1.Text & "' AND pword='" & TextBox2.Text & "';"
        cm.Connection = cn
        adap.SelectCommand = cm
        Dim ds As New DataSet
        adap.Fill(ds, "0")
        Dim count = DataSet.Tables(0).Rows.Count
        If count > 0 Then
            MsgBox("Login Successfull", MsgBoxStyle.Information, "Login Passed")
        Else
            MsgBox("Invalid Account", MsgBoxStyle.Critical, "Login Failed")
            TextBox1.Clear()
            TextBox2.Clear()
        End If





i发现

Dim count = DataSet.Tables(0).Rows.Count

错误''表格(0)''

因为我不使用sql .. :(

帮帮我吧..

thx



i found that
Dim count = DataSet.Tables(0).Rows.Count
got error on ''tables(0)''
cause i m not using sql.. :(
help me pls..
thx

推荐答案

arnoldxx,look只需稍作调整即可让您的代码正常工作。 DataSet是一个Type,因此不是你用适配器填充的实际目标。



arnoldxx, looks like just a minor adjustment will get your code to work. DataSet is a Type and therefore not the actual target you are filling with the adapter.

Dim count = DataSet.Tables(0).Rows.Count





应该......





Should be...

Dim count = ds.Tables(0).Rows.Count


这篇关于使用visual basic和access登录系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆