| | |
Probem with Checking the database
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2008
Posts: 92
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 |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms ftp generatetags html images input insert intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey table temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





