private void ShowFRubric(string strRubric)
{
this.DataGridF.Visible = true;
int num = 0;
string text = "Select ID,SubjectID,RubricType,RubricTitle,OptionAnswer,OKAnswer,HandleMemo from RubricInfo ";
string text2 = "";
string[] textArray = strRubric.Split(new char[] { '#' });
if (textArray.Length > 0)
{
for (int j = 0; j < textArray.Length; j++)
{
if (text2.Length <= 0)
{
text2 = " where ID='" + textArray[j] + "'";
}
else
{
text2 = text2 + " or ID='" + textArray[j] + "'";
}
}
}
string connectionString = ConfigurationSettings.AppSettings["strConn"];
SqlConnection selectConnection = new SqlConnection(connectionString);
SqlDataAdapter adapter = new SqlDataAdapter(text + text2, selectConnection);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet, "FRubric");
this.DataGridF.DataSource = dataSet.Tables["FRubric"].DefaultView;
this.DataGridF.DataBind();
for (int i = 0; i < this.DataGridF.Items.Count; i++)
{
num++;
Label label = (Label) this.DataGridF.Items[i].FindControl("labFDataTitle");
TextBox box = (TextBox) this.DataGridF.Items[i].FindControl("txtFAnswerA");
TextBox box2 = (TextBox) this.DataGridF.Items[i].FindControl("txtFAnswerB");
TextBox box3 = (TextBox) this.DataGridF.Items[i].FindControl("txtFAnswerC");
TextBox box4 = (TextBox) this.DataGridF.Items[i].FindControl("txtFAnswerD");
switch (label.Text.ToString().Replace("<P>", "").Replace("</P>", "").Replace("___", "#").Split(new char[] {0xff03}).Length)
{
case 0:
break;
case 1:
box.Visible = false;
box2.Visible = false;
box3.Visible = false;
box4.Visible = false;
break;
case 2:
box.Visible = true;
box2.Visible = false;
box3.Visible = false;
box4.Visible = false;
break;
case 3:
box.Visible = true;
box2.Visible = true;
box3.Visible = false;
box4.Visible = false;
break;
case 4:
box.Visible = true;
box2.Visible = true;
box3.Visible = true;
box4.Visible = false;
break;
default:
box.Visible = true;
box2.Visible = true;
box3.Visible = true;
box4.Visible = true;
break;
}
label.Text = num.ToString() + "、" + label.Text.ToString().Replace("<P>", "").Replace("</P>", ""); ___编译时"无法将常数值“65283”无法转换为“char”
"
}
adapter.Dispose();
dataSet.Clear();
dataSet.Dispose();
selectConnection.Dispose();
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!