到底哪里出错了?
Imports System.DataImports System.Data.OleDb
Public Class 登录
Dim searchSQL As Object
Public ADOcmd As OleDbDataAdapter
Public ds As DataSet = New DataSet()
Public mytable As Data.DataTable
Public myrow As Data.DataRow
Public rownumber As Integer
Public cmd As OleDbCommandBuilder
Public Function ExecuteSQL(ByVal SQL As String, ByVal table As String)
ADOcmd = New OleDbDataAdapter(SQL, "Provider = Microsoft.Jet.OLEDB.4.0;Data Sourxe = D:\sql\jwxt.mdb")
ADOcmd.Fill(ds, table)
mytable = ds.Tables.Item(0)
rownumber = 0
myrow = mytable.Rows.Item(rownumber)
End Function
Private Sub BtOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtOK.Click
Dim tablename As String
tablename = "userID"
searchSQL = "select 用户名 , 密码 from userID where (用户名='" & txtusername.Text & " ')"
Try
ExecuteSQL(SearchSQL, tablename)
If myrow.Item(1) = txtuserpassword.Text Then
Dim newFrmmain As New frmMain()
Me.Hide()
Else
Exit Sub
End If
Catch ex As Exception
MsgBox("没有该用户", vbOKOnly + vbExclamation, "警告")
End Try
End Sub
Private Sub txtusername_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtusername.Validating
If txtusername.Text = "" Then
ErrorProvider1.SetError(txtusername, "用户不能为空")
Else
ErrorProvider1.SetError(txtusername, "")
End If
End Sub
Private Sub txtuserpassword_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtuserpassword.Validating
If txtuserpassword.Text = "" Then
ErrorProvider1.SetError(txtuserpassword, "密码不能为空")
Else
ErrorProvider1.SetError(txtuserpassword, "")
End If
End Sub
Private Sub BtCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtCancel.Click
End
End Sub
End Class
补充:.NET技术 , VB.NET