-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: marythengil
Message 6 in Discussion
Dear All, Thank you very much. I understood that but Sir/s, what is "debatable" in
the answer for the question "Is stored procedure faster?" I have another doubt in
the following piece of code, This is a simple login form with a condition that if
the person fails to login for more than 3 times then the application is to be closed.
Dim intloginCount As Integer = 0
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnLogin.Click
Dim conn As New OleDb.OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data
Source=C:\swimmy\EMPLOYEE_DETAILS.mdb"
Dim da As New OleDb.OleDbDataAdapter()
Dim cmdUsernamePassword As New OleDb.OleDbCommand()
Dim ds As New DataSet()
cmdUsernamePassword.Connection = conn
cmdUsernamePassword.CommandType = CommandType.Text
cmdUsernamePassword.CommandText = "Select Count(*) from Employee_master Where
Username='" & txtUsername.Text & "' and Password='" & txtPassword.Text & "' "
da.SelectCommand = cmdUsernamePassword
da.Fill(ds, "Employee_Master")
If intloginCount <= 2 Then
If ds.Tables("Employee_Master").Rows.Count = 1 Then
MessageBox.Show("Login succeded.")
ElseIf ds.Tables("Employee_Master").Rows.Count = 0 Then
intloginCount += 1
MessageBox.Show("Login failed.")
End If
Else
Me.Close()
End If
End Sub
Here when I use Count(*) in the select command I get count as 1 even if there is no
record existing whereas when I specifically select Username and Password and if it
does not match it gives me count as 0.
How so?
Kindly help.
Thanking you.
sincerely,
mary.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]