For connectivity in visual studio
open Server Explorer
right click add Connection
Follow simple steps
After Creating Connection Right click on Database
Click on properties
In Proprties Connection String will be found.
Copy This String.
private void button1_Click(object sender, EventArgs e)
{
string cmd="select *from Admin where ID='"+txtFilenO.Text+"' and Password='"+textBox1.Text+"' ";
SqlConnection con=new SqlConnection();
con.connectionString="Paste Connection String";
con.Open();
SqlCommand cmd1 = new SqlCommand(cmd,con);
SqlDataReader dr = cmd1.ExecuteReader();
if (dr.Read())
{
AdminMenu n = new AdminMenu();
n.lblsser.Text = dr[0].ToString();
n.Show();
this.Dispose();
this.Close();
cmd1.Connection.Close();
}
else
{
cmd1.Connection.Close();
MessageBox.Show("ID/Password is not valid");
}
}
it is connection from wizard,But You should learn meaning of each keyword, So keep l;earning from Google and MSDN.