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
mahmud_uk
NA
48
0
Authenticate users
Aug 6 2004 9:24 AM
Hi guys, I have two forms, form1 and form2. I also have this login page written in C# in form1. I'm trying to authenticate users through SQL database, if authenticated they will login to form 2, if not an error message should pop up and not allow form2 to open. Also after authentication is sucessfull, form1 should close and form2 should stay open. Here's the code: da.Open(); SqlCommand thisCommand = da.CreateCommand(); String sQuery = "SELECT * FROM License WHERE Name = '"+ textBox1.Text +"' AND LicenseID = '"+ textBox2.Text +"'"; SqlCommand cmd = new SqlCommand(sQuery, da); SqlDataReader dr = cmd.ExecuteReader(); Form2 frm = new Form2(); //if (dr.Tables["License"].Rows.Count == 0) //MessageBox.Show("Incorrect UserName and/or ID, Try again!"); da.Close(); frm.Show(); I'm stuck on authentication and closing the form1, can someone direct me where i have gone wrong. Thanks, Mac
Reply
Answers (
4
)
How to have two tables on a single dataset?
Connection Pooling Problem