Public Class Form4
Dim objcon As New OleDbConnection
Dim strSQL As String
Dim strconnection As String = "provider=microsoft.ACE.OLEDO.12.0;Data Source=shweta:\WindowsApplication1\Databaseapp.accdb"
Dim da As New OleDbDataAdapter
Dim ds As New DataSet
Dim attempt As Integer = 0
Private Sub btnsignin_Click(sender As Object, e As EventArgs) Handles btnsignin.Click
Dim strName = txtpassword.Text
Dim strpass = txtpassword.Text
With objcon
.Close()
If .State = ConnectionState.Closed Then
.ConnectionString = strconnection
.Open()
'{they r showing An unhandled exception of type
'System.InvalidOperationException' occurred in
' System.Data.dll }}
MsgBox("connectionstate.open", MsgBoxStyle.Information, "connected")
End If
End With
ds.Clear()
strSQL = "Select * from logintable where username='" & Txtusername.Text & "' And password =''" & txtpassword.Text '"
da = New OleDbDataAdapter(strSQL, objcon)
da.Fill(ds, "logintable")
If ds.Tables("logintable").Rows.Count <> 0 Then
MaximizeBox = True
MinimizeBox = True
Else
MaximizeBox = False
MinimizeBox = False
MessageBox.Show("invalid")
End If
Form2.Show()
Me.Hide()
End Sub
End Class
答案 0 :(得分:-2)
以下是错误修正:
Imports System.Data.OleDb
之前放置Public Class Form4
,那就有效。Public Property Form2 As Object
。仍有部分代码丢失。你能说明一下吗?