SqlConnection baglan = new SqlConnection(ConfigurationManager.ConnectionStrings["Mimarlik_Con_Str"].ToString());
SqlCommand sorgu = new SqlCommand("SELECT * FROM Kullanici where kullanici_username=@username and kullanici_password=@password", baglan);
sorgu.Parameters.AddWithValue("@username", TextBox1.Text);
sorgu.Parameters.AddWithValue("@password", TextBox2.Text);
baglan.Open();
SqlDataReader veri_oku = sorgu.ExecuteReader();
if (veri_oku.Read())
{
Session["kullanici_id"] = veri_oku["kullanici_id"];
Session["kullanici_adi"] = veri_oku["kullanici_adi"];
Session["kullanici_soyadi"] = veri_oku["kullanici_soyadi"];
Session["kullanici_yetki"] = veri_oku["kullanici_yetki"];
baglan.Close();
Response.Redirect("Default.aspx");
}
bu kod nerede bulunuyor yanı hangı aspx altındabu belki güzel bir örnek olabilir. hatayı direk yazarsan da cevap verebilirim.PHP:SqlConnection baglan = new SqlConnection(ConfigurationManager.ConnectionStrings["Mimarlik_Con_Str"].ToString()); SqlCommand sorgu = new SqlCommand("SELECT * FROM Kullanici where kullanici_username=@username and kullanici_password=@password", baglan); sorgu.Parameters.AddWithValue("@username", TextBox1.Text); sorgu.Parameters.AddWithValue("@password", TextBox2.Text); baglan.Open(); SqlDataReader veri_oku = sorgu.ExecuteReader(); if (veri_oku.Read()) { Session["kullanici_id"] = veri_oku["kullanici_id"]; Session["kullanici_adi"] = veri_oku["kullanici_adi"]; Session["kullanici_soyadi"] = veri_oku["kullanici_soyadi"]; Session["kullanici_yetki"] = veri_oku["kullanici_yetki"]; baglan.Close(); Response.Redirect("Default.aspx"); }
bu kod nerede bulunuyor yanı hangı aspx altında