473,473 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to get exactl y information from the database

29 New Member
hello

i have an aspx page that Contains tow textBoxs and Button

i Must enter a correct username at the textbox 1 and password in textbox 2 that exists in database

my command have this code

Expand|Select|Wrap|Line Numbers
  1. MyCom = new SqlCommand("select * from Users where UserName='"+TextBox1.Text+"' and Password='"+TextBox2.Text+"'",MyCon);
i want to show an error message that containt "Your Password is Wrong" if the user enter a correct user name but wrong Password

and another message that say "UserName Is not found in our db" if the user enter an unavalable username

i used this code

Expand|Select|Wrap|Line Numbers
  1. if (DataReader.Read())
  2.         {
  3.             Response.Redirect("Default.aspx?uname="+TextBox1.Text);
  4.         }
  5.         else
  6.         {
  7.             MessageBox.Show("Invaild Data");
  8.         }
but its not say where is the error exactly

its dont say if the username is wrong or the password

its just say invaild data

any body can help me ?!?
Mar 2 '07 #1
1 1098
ElmerCarias
1 New Member
The only way is if you evaluate first if user exists,
"select count(*) from Users where UserName=@UserName"
execute and continues if result is 1, returns CustomCodeError like -1

then validate the user and password

"select count(*) from Users where UserName=@UserName and Password=@Password"

execute and returns 1 if is succesfull, and return -2 if not,

in the call to your function evaluate the result and show to the user the specific message for the result.

Elmer Carías
TI Consultant
El Salvador, Central America.
Mar 2 '07 #2

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

Similar topics

0
by: Emine Ekin | last post by:
/*Apologize for multiple posts*/ FIRST CALL FOR PAPERS ADVIS 2006 Fourth Biennial International Conference on Advances in Information Systems 18-20 October, 2006 Izmir, Turkey
0
by: Lester Knutsen | last post by:
A two-day IBM Informix and DB2 User Group Technical Conference - Friday and Saturday, December 8-9, 2006 Location - Fairview Park Marriott, Falls Church, VA (near Washington D.C.)...
22
by: Sandman | last post by:
So, I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other...
22
Frinavale
by: Frinavale | last post by:
How To Use A Database In Your Program Many .NET solutions are database driven and so many of us often wonder how to access the database. To help you understand the answer to this question I've...
3
by: Knowledge | last post by:
Good day mates, I'm trying to build a database to keep track of information that will be stored when my client kicks off his brand new Taxi Cab business. Initially it will be a one person...
3
by: Nymus | last post by:
I would like to use an access database as a shared database on a remote website. I don't know if it is possible, but this is what i would like to do with this database: - Use it to run a database...
0
by: Nymus | last post by:
I would like to use an access database as a shared database on a remote website. I don't know if it is possible, but this is what i would like to do with this database: - Use it to run a database...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.