| | |
Probem with Checking the database
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2008
Posts: 117
Reputation:
Solved Threads: 2
Hello,
I am doing Login Screen in VS2008.
When i logon with username and password in form it only checking the first field in database.
How to do coding for checking all the fields???
This is my coding
I am doing Login Screen in VS2008.
When i logon with username and password in form it only checking the first field in database.
How to do coding for checking all the fields???
This is my coding
VB.NET Syntax (Toggle Plain Text)
Imports System.Data.OleDb Public Class frmLogin Private connstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db.mdb" Private conn As OleDb.OleDbConnection Private dr As OleDb.OleDbDataReader Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load conn = New OleDbConnection(connstring) conn.Open() End Sub Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click Dim cmd As New OleDbCommand("select * from login", conn) dr = cmd.ExecuteReader dr.Read() If dr(0) = txtUser.Text And dr(1) = txtPwd.Text Then Form2.Show() Else txtUser.Clear() txtPwd.Clear() txtUser.Focus() End If End Sub End Class
Hi,
I do not know if this can help but try it
replace dr(0) for dr.GetString(0) and dr.GetString(1).
also try in the select retrieve exact the two fields that you want, i do not know what is the structure of your table. if that does not work try this
I do not know if this can help but try it
replace dr(0) for dr.GetString(0) and dr.GetString(1).
also try in the select retrieve exact the two fields that you want, i do not know what is the structure of your table. if that does not work try this
Dim cmd As New OleDbCommand("select * from login where id= '"+txtUser.Text+"' and pass='"+txtPwd.Text+"'", conn)
dr = cmd.ExecuteReader
if(dr.HasRows)
Form2.Show()
Else
txtUser.Clear()
txtPwd.Clear()
txtUser.Focus()
End If![]() |
Similar Threads
Other Threads in the VB.NET Forum
- Previous Thread: Multiform view inside a formview inside a repeater control
- Next Thread: Array with radiobuttons
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access advanced application array basic beginner browser button buttons center click client code combo convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel exists fade filter forms function html images input lib listview map mobile module msaccess net number objects open panel pdf picturebox picturebox2 port position print printing problem read regex remove right-to-left save search searchvb.net serial settings shutdown socket sorting sqldatbase sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter user usercontol validation vb vb.net vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms winsock wpf wrapingcode xml year





