求助 在线考试系统判断单选题对错代码
如何将下列c#代码用vb.net怎么写啊?急急急急急急急!
//核对单选题答案
case 3:
SqlDataAdapter myadapter3 = new SqlDataAdapter("select id,que_answer"+ " from tb_Questions where que_type='单选题'and que_lessonid='"+ dd1 + "'and que_taotiid='" + dd2 + "'order by id desc", con);
DataSet myds3 = new DataSet();
myadapter3.Fill(myds3);
DataRow[] row1 = myds3.Tables[0].Select();
//计算单选题成绩
foreach (DataRow answer1 in row1)
{
int_row1 += 1;
RadioButtonList rbl = (RadioButtonList)(DataList1.Items[int_row1 - 1].FindControl("RadioButtonList1"));
if (rbl.SelectedValue == "")
{
this.lblSel.Text = "单选题:0分";
}
Else
{
if (answer1["que_answer"].ToString().Trim() == rbl.SelectedValue.ToString().Trim())
{
int_row1Point += 40 / DataList1.Items.Count;
this.lblSel.Text = "单选题:" + int_row1Point.ToString() + "分";
}
}
}
break;
[解决办法]
Case 3
Dim myadapter3 As SqlDataAdapter = New SqlDataAdapter("select id,que_answer" + " from tb_Questions where que_type='单选题'and que_lessonid='" + dd1 + "'and que_taotiid='" + dd2 + "'order by id desc", con)
Dim myds3 As DataSet = New DataSet()
myadapter3.Fill(myds3)
Dim row1() As DataRow = myds3.Tables(0).Select()
'计算单选题成绩
For Each answer1 As DataRow In row1
int_row1 += 1
Dim rbl As RadioButtonList = CType(DataList1.Items(int_row1 - 1).FindControl("RadioButtonList1"), RadioButtonList)
If (rbl.SelectedValue = "") Then
Me.lblSel.Text = "单选题:0分"
Else
If (answer1("que_answer").ToString().Trim() = rbl.SelectedValue.ToString().Trim()) Then
int_row1Point += 40 / DataList1.Items.Count
Me.lblSel.Text = "单选题:" + int_row1Point.ToString() + "分"
End If
End If
Next
Exit Select