using System.Windows.Forms;
using System.Data.SqlClient;
using system.data.sqlclient;ur sql address
public partial class formLogin : Form
private void btnLogin_Click(object sender, EventArgs e)
sqlconnection con =new sqlconnection = @"Data Source=as ur one;Integrated Security=True;
sql command cmd=new sqlcommand("select from login where username='"+textuser.text+" and password='"+textpass.text+'"
sqldataadepter sda=new SqlDataAdapter(cmd);
data table dt=new datatable();
string cmbitemvalue=comboBox1.selecteditem.tostring()==cmbitemvalue
messegebox.show("You are login as "+dt.rows[i][2];
if(comboBox1.selectedindex==0)
else if (comboBox1.selectedindex==1)
else if (comboBox1.selectedindex==2)
else if (comboBox1.selectedindex==3)
else (comboBox1.selectedindex==4)
if (txtUserName.Text == "")
MessageBox.Show("Please enter username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (txtPassword.Text == "")
MessageBox.Show("Please enter password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
cmd.Parameters.AddWithValue("@userid", txtUserid.Text.ToString());
cmd.Parameters.AddWithValue("@password", txtPassword.Text.ToString());
cmd.parameters.addwithvalue("@type",cmbox.text.tostring)();
if (myConnection.State == ConnectionState.Open)
private void btnExit_Click(object sender, EventArgs e)