TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Farrukh Javeid
NA
38
0
Index Outside the bounds of array
Feb 18 2010 11:47 AM
Hello,
I have written a code to create the login module of a system. I dont know what is the problem, i have done the exact code before and it worked but this time its giving an exception "Index outside the bounds of array".
The code is
string login = "select Password from UserInfo where Username = "+tbx_username.Text+"'";
conn.Open();
SqlCommand cmd = new SqlCommand(login, conn);
SqlDataReader reader = null;
reader = cmd.ExecuteReader();
if (reader.Read())
{
if (tbx_password.Text == reader.GetValue(1).ToString())
{
MessageBox.Show("welcome " + tbx_username.Text + "");
}
}
else
{
MessageBox.Show("invalid username or password!");
}
conn.Close();
Any urgent help will be very much appreciated!
Regards!
Reply
Answers (
4
)
Manipulate Formview display data
Populating the treeview