Click here to Skip to main content
15,914,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
cn.Open();
string name;
string pass;
        string query = "select user_name,password from login_detail where user_name='" + text_user_name + "' & password='" + text_password + "'";
        cmd = new OleDbCommand(query, cn);

I want to store user_name into name & password into pass. help me...
Posted
Updated 24-Feb-14 23:14pm
v2

Try this

C#
cmd = new OleDbCommand(query, cn); 
        cn.Open();
        OleDbDataReader reader = cmd.ExecuteReader(); 
        while (reader.Read())
        {
            name =  reader.GetString(0);
            pass = reader.GetString(1);
        }
 
Share this answer
 
Comments
Rajkumar_007 25-Feb-14 6:10am    
these are not working, name and pass is always null....
Have a look at that:
OleDbCommand Class[^]

There you will find a complete documentation on the class you are using, as well as some examples on how to actually use it.

Good luck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900