我正在开发一个Vb.net桌面应用程序登录页面,我在MS Access中创建了数据库,当我在数据网格视图中显示数据时,它显示了我在DIV中保存在数据库表中的数据。
任何建议......
我的代码是:
Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|hrm.accdb")
Dim cmd As OleDbCommand = New OleDbCommand(
"SELECT * FROM admin WHERE username = '" & txt_user.Text & "' AND password = '" & txt_pass.Text & "' ", conn)
conn.Open()
Dim sdr As OleDbDataReader = cmd.ExecuteReader()
' If the record can be queried, it means passing verification, then open another form.
If (sdr.Read() = True) Then
Dim hrmAdminPanel As New hrmAdminPanel
hrmAdminPanel.Show()
Me.Hide()
Else
MessageBox.Show("Invalid name or password!")
End If
End Sub
答案 0 :(得分:0)
默认情况下,MS ACCESS中字段的数据类型为MEMO,我将其更改为文本并解决了问题。现在它的工作非常好