public partial class Home_AlumniLogin : System.Web.UI.Page
{
Buildconnection c = new Buildconnection();
public string conn = ConfigurationSettings.AppSettings["dsn"];
public string str = "Data Source=S-90E1F156B1BF4\\SQLEXPRESS;uid=a;database=college";
public SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
con = new SqlConnection(conn);
string str = "select ID1 from student where ID1='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'";
con.Open();
SqlCommand cmd = new SqlCommand(str, con);
string a = Convert.ToString(cmd.ExecuteScalar());
if (a == "")
{
Message.Text = "User Not Found";
}
else
{
Session["ID1"] = a;
Response.Redirect("../Student/AlumniHome.aspx");
}
}
}
I got an error at con.Open();
please help me....it's very urgent....