Database
I am designing a login form in windows application , how can I compare whether the details enter by user is available in Data base or not
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Neha SharmaRank #569 · 4.3K reputationPosted Apr 20, 2013, 4:28 AM EDT
You can use the same code like web applications.
Satyapriya NayakRank #47 · 31.5K reputationPosted Apr 20, 2013, 4:53 AM EDT
Sathish Pabbathi99 reputationPosted Apr 20, 2013, 6:10 AM EDT
http://www.dotnetfunda.com/forums/thread9061-how-to-read-values-from-database-for-loginpagewindows-forms.aspx
Shankar MRank #874 · 2.5K reputationPosted Apr 26, 2013, 2:23 AM EDT
Validating the User Name and Password against the Database is quite simple only. Try this
Create a VALIDATEUSER Table in your SQL Server Database.
CREATE TABLE VALIDATEUSER(USERNAME VARCHAR(20),
Sample Insert Statement :
INSERT INTO VALIDATEUSER VALUES('Ravi','ravi123',1)
Try this Code,
Here, We create an instance of SqlConnection Class and SqlCommand Class.
The SqlCommand uses the SqlConnection object to execute the SQL Statement.
Using the AddWithValue Method we pass the Parameter and the value that is UserName and Password.
Then, I have loaded the result set in to DataTable object.You can do it any of many ways.
Then, if the count of the DataTable is 0 Indicates that no records are returned so the User Name of Password entered is Invalid.