473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

problem please check .!!

have a look at this code , its for logging the user in after checking his UserName and Password.

dim check as boolean = false
...
...

If txtUserName.Text.Length = 0 And txtPass.Text.Length = 0 Then
MessageBox.Show("please Enter Your Name and Password")
txtUserName.Text = ""
txtPass.Text = ""
Exit Sub
End If

Dim conn As New SqlConnection
Dim cmd As New SqlCommand
Dim rd As SqlDataReader
conn.ConnectionString = "Data Source=PC100-042295F4E;" & "Trusted_connection=yes;" & "initial Catalog=Client;"

conn.Open()
cmd.Connection = conn

cmd.CommandText = (" SELECT Emp_user, Emp_pass FROM Emp_Info") 'SELECT User_UserName, User_Pass FROM Users_Tb where User_UserName=" + txtUserName.Text + " AND User_Pass=" + txtPass.Text)
rd = cmd.ExecuteReader

While rd.Read ''''''''''''' my problem starts here ******

If rd.Item("Emp_user") = LCase(txtUserName.Text) And rd.Item("Emp_pass") = LCase(txtPass.Text) Then
Dim main As New MainFrm
main.ShowDialog()
check = True
Me.Close()
rd.Close()
Exit While
Else
check = False
End If
End While
If check = False Then
MessageBox.Show("Please Recheck User Name and Password")
txtUserName.Text = ""
txtPass.Text = ""
End If
conn.Close()

my problem in the while section ... it jumps out of it to show me the MessageBox ("please Recheck ....... ") , what is the problem. ?!! .. please advise . Thank you very much.
Feb 9 '07 #1
1 1398
Are you getting data in the DataReader from the database First Debug to see it and Always use trim proprty in the password textbox value it may contain spaces
Feb 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Bartosz Wegrzyn | last post by:
I need help with sessions. I createt set of web site for nav with authorization. first I go into main.php which looks like this: <?php //common functions include_once '../login/common.php';...
11
by: Wayne Wengert | last post by:
I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000 database. I want to display a list of all tables in an Access database. I want to put that list of table names in a listbox so the user...
0
by: Marko | last post by:
Please, can anyone help me... I have problem with VisualStudio.NET instalation: First step is OK (framework...), but when instalation of .NET begin, after some time I get message "INSTALATION...
9
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
10
by: greenb | last post by:
Our asp.net web app uses a .NET component (DLL) in the bin directory to call several stored procedures back to back to perform updates. They don't return any data. Sometimes the total execution...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
8
by: sara | last post by:
I have a report that runs fine with data. If there is no data, I have its NO Data event sending a MsgBox and cancelling the report. Then it seems I still get the 2501 message on the Open Report...
9
by: Jerim79 | last post by:
Here it is: <?php if($_SERVER=='POST'){ $Number=$_POST; $Email=$_POST; $Number2=0; $error=0;
2
by: swethak | last post by:
hi , i write the code in .htm file. It is in cgi-bin/searches/one.htm.In that i write a form submitting and validations.But validations are not worked in that .htm file. I used the same code in my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.