PDA

View Full Version : error no value given for one or more parameters



f_naderi
سه شنبه 11 آبان 1395, 21:17 عصر
سلام دوستان
من می خوام با تغییر نام درس تعداد سوالات موجود بر اساس پایه و رشته و درس مورد نظر نمایش داده شود ولی موقع اجرا پیغام no value given for one or more parameters نمایشداده میشه و دوبار که ok میزنم بعد تازه محتویات combo نشون داده میشه و با انتخاب درس مورد نظر تعداد سوالات نمایش داده میشه. اینم کد
private void comboBox3_TextChanged(object sender, EventArgs e) {


string Type_Q = "";
string Level = "";
if (radioButton1.Checked)
Type_Q = radioButton1.Text.Trim();
else if (radioButton2.Checked)
Type_Q = radioButton2.Text.Trim();




if (radioButton4.Checked)
Level = radioButton4.Text.Trim();
else if (radioButton5.Checked)
Level = radioButton5.Text.Trim();


try
{
Class1.dsclass7.Clear();
Class1.dsclass7.Tables.Clear();
Class1.con.Open();
Class1.str2 = "select count(Num_Question) from Quastion,Lesson where Quastion.L_Code=Lesson.L_Code and Type_Q='" + Type_Q + "' and Level='" + Level + "' and Lesson.Base_N='" + comboBox1.Text.Trim() + "' and Lesson.Branch='" + comboBox2.Text.Trim() + "' and Lesson.L_Code=" + comboBox3.SelectedValue;
Class1.da1 = new System.Data.OleDb.OleDbDataAdapter(Class1.str2, Class1.con);
Class1.da1.Fill(Class1.dsclass7);
if (Class1.dsclass7.Tables[0].Rows.Count > 0)
label9.Text = Class1.dsclass7.Tables[0].Rows[0][0].ToString();
Class1.con.Close();


}
catch (Exception ex)
{
Class1.con.Close();
MessageBox.Show(ex.Message, "پیغام", MessageBoxButtons.OK);
}

}
کد رو داخل رویدادهای ValueMemberChangedو SelectedIndexChangedو SelectedValueChanged هم نوشتم باز همین مشکل وجود داره.