raha1234567
دوشنبه 21 فروردین 1391, 10:44 صبح
سلام دوستان من برای نظر سنجی سایتم این کد رو نوشتم ولی مقدار اضافه نمیکنه و فقط یک بار رای رو اضافه میکنه چرا؟؟؟؟؟
protected void ray_Click(object sender, EventArgs e)
{int a,b,c;
a = b = c= 1;
//string con1 = "server=.;database=shahinshahr;integrated security=true";
//SqlConnection con = new SqlConnection(con1);
if (rbali.Checked == true)
{
a++;
//SqlCommand com = new SqlCommand("insert into nazar(verygood)values(@verygood)", con);
// com.Parameters.AddWithValue("@verygood", tbgood.Text);
//con.Open();
//com.ExecuteNonQuery();
//con.Close();
// Session["verygood"] = tbgood.Text;
//a = 0;
}
else if (rbmain.Checked==true)
{
b++;
//SqlCommand com = new SqlCommand("insert into nazar(main)values(@main)", con);
// com.Parameters.AddWithValue("@main", tbmain.Text);
// con.Open();
// com.ExecuteNonQuery();
//con.Close();
//b = 0;
}
else if (rbbad.Checked==true)
{
c++;
//SqlCommand com = new SqlCommand("insert into nazar(bad)values(@bad)", con);
//com.Parameters.AddWithValue("@bad", tbbad.Text);
// con.Open();
// com.ExecuteNonQuery();
// con.Close();
// c = 0;
}
Session["ba"] = c;
Session["ma"] = b;
Session["w"] = a;
// d += a + b + c;
// a = b = c = 0;
//lblkol.Text += d.ToString();
// d = 0;
}
و اینم برا فرا خونیش در صفحه نتیجه است
lblgood.Text = Session["w"].ToString();
lblmain.Text = Session["ma"].ToString();
lblbad.Text = Session["ba"].ToString();
protected void ray_Click(object sender, EventArgs e)
{int a,b,c;
a = b = c= 1;
//string con1 = "server=.;database=shahinshahr;integrated security=true";
//SqlConnection con = new SqlConnection(con1);
if (rbali.Checked == true)
{
a++;
//SqlCommand com = new SqlCommand("insert into nazar(verygood)values(@verygood)", con);
// com.Parameters.AddWithValue("@verygood", tbgood.Text);
//con.Open();
//com.ExecuteNonQuery();
//con.Close();
// Session["verygood"] = tbgood.Text;
//a = 0;
}
else if (rbmain.Checked==true)
{
b++;
//SqlCommand com = new SqlCommand("insert into nazar(main)values(@main)", con);
// com.Parameters.AddWithValue("@main", tbmain.Text);
// con.Open();
// com.ExecuteNonQuery();
//con.Close();
//b = 0;
}
else if (rbbad.Checked==true)
{
c++;
//SqlCommand com = new SqlCommand("insert into nazar(bad)values(@bad)", con);
//com.Parameters.AddWithValue("@bad", tbbad.Text);
// con.Open();
// com.ExecuteNonQuery();
// con.Close();
// c = 0;
}
Session["ba"] = c;
Session["ma"] = b;
Session["w"] = a;
// d += a + b + c;
// a = b = c = 0;
//lblkol.Text += d.ToString();
// d = 0;
}
و اینم برا فرا خونیش در صفحه نتیجه است
lblgood.Text = Session["w"].ToString();
lblmain.Text = Session["ma"].ToString();
lblbad.Text = Session["ba"].ToString();