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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shankar MPosted Apr 26, 2013, 6:23 AM
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.
Sathish PabbathiPosted Apr 20, 2013, 10:10 AM
http://www.dotnetfunda.com/forums/thread9061-how-to-read-values-from-database-for-loginpagewindows-forms.aspx
Satyapriya NayakPosted Apr 20, 2013, 8:53 AM
Neha SharmaPosted Apr 20, 2013, 8:28 AM
You can use the same code like web applications.