Hai
Try this
private void btnOk_Click(object sender, EventArgs e)
{
SqlConnection connect = new SqlConnection(@"data source=ABHINAV-PC\ABHI;integrated security=true;initial catalog=ATM;");
DataTable dt1 = new DataTable();
string strcmd1 = "";
SqlDataAdapter cmd1 = new SqlbDataAdapter;
connect.Open();
strcmd1 = ("SELECT UserName, PassWord FROM Admin WHERE UserName='" & Textbox1.Text.Trim() & "' and Password='" & Textbox1.Text.Trim() & "'");
cmd1 = new SqlDataAdapter(new SqlCommand(strcmd1));
cmd1.SelectCommand.Connection = connect;
cmd1.Fill(dt1)
if ((dt1.Rows.Count > 0)) {
Administrator_Home ah = new Administrator_Home();
ah.Show();
} else {
MessageBox.Show("invalid username or password");
}
}
}
}