Click here to Skip to main content
15,906,558 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to use three different columns from data table which created in data base sqlAddpater in c#
I am going to login with admin and user


I am going to show when admin logged then show admin window and when user logged then show user window
by using data base in c#
Posted
Comments
ZurdoDev 30-Dec-15 14:08pm    
If you have a SqlDataAdapter then use it to fill a DataSet. Where are you stuck?

C#
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\NANO\Documents\nan.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
            SqlDataAdapter sda = new SqlDataAdapter("select count(*) from  registration where name ='" + textBox1.Text + "' and password= '" + textBox2.Text + "'", con);
            DataTable dt = new DataTable();
            sda.Fill(dt);
            if (dt.Rows[0][0].ToString() == "1")
            {
                this.Hide();
              
                wlcm ww = new wlcm(textBox1.Text);<pre lang="c#">

ww.Show();
}
else
{
MessageBox.Show("please check your user id or password");
}
this is my code for login id and password, i have stored account tpye is registartion table in that table column name is actype...
help me for doing login with user id , pasword and account type, is admin or user
 
Share this answer
 
Try this

select [col1]+[col2]+[col3] as sumadd from [tablename] order by sumadd
 
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