Hi,
In Visual studio 2008, i got a error "ExecuteRea der: Connection property has not been initialized" . So guide me
[code=cpp]
protected void Button1_Click(o bject sender, EventArgs e)
{
string constr=Configur ationSettings.A ppSettings["Myconn"];
SqlConnection conn = new SqlConnection(c onstr);
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from users where username='" + txtusername.Tex t + "' and user_password=' " + txtpassword.Tex t + "'";
SqlDataReader rd = cmd.ExecuteRead er();
if (rd.HasRows == true)
{
Response.Redire ct("Index.aspx" );
}
conn.Close();
}[/code]
In Visual studio 2008, i got a error "ExecuteRea der: Connection property has not been initialized" . So guide me
[code=cpp]
protected void Button1_Click(o bject sender, EventArgs e)
{
string constr=Configur ationSettings.A ppSettings["Myconn"];
SqlConnection conn = new SqlConnection(c onstr);
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from users where username='" + txtusername.Tex t + "' and user_password=' " + txtpassword.Tex t + "'";
SqlDataReader rd = cmd.ExecuteRead er();
if (rd.HasRows == true)
{
Response.Redire ct("Index.aspx" );
}
conn.Close();
}[/code]
Comment