求大侠帮忙。由page_load传到button1_click里查询语句数据不全或不对,怎么解决。strids所传的值不全或不对,r
求大侠帮忙。由page_load传到button1_click里查询语句数据不全或不对,怎么解决。
strids所传的值不全或不对,radiobuttonlist所选择的数据与a1里面的对应不上。
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Write("<script lanuage=javascript>alert('您确定要提交这些随机抽查数据吗?');localtion='diaocha.aspx';</script>")
Button1.Enabled = False
strids = strids.TrimEnd(","c)
Dim connstr As String
connstr = ConfigurationManager.AppSettings("strconn").ToString
Dim conn As New SqlConnection(connstr)
Dim myadapter3 As SqlDataAdapter = New SqlDataAdapter("select * from shuju where id in (" & strids & ")", conn)
Dim myds3 As DataSet = New DataSet()
myadapter3.Fill(myds3)
Dim a1() As DataRow = myds3.Tables(0).Select()
int_row3 = 0
int_row3Point = 0
For Each answer1 As DataRow In a1
int_row3 += 1
Dim rbl As RadioButtonList = CType(DataList1.Items(int_row3 - 1).FindControl("RadioButtonList2"), RadioButtonList)
If (rbl.SelectedValue = "") Then
Label12.Text = "正确数据个数为:" + int_row3Point.ToString() + "个"
Else
If (a1("zqsj").ToString().Trim() = rbl.SelectedValue.ToString().Trim()) Then
int_row3Point +=1
Label12.Text = "正确数据个数为:" + int_row3Point.ToString() + "个"
Else
Label12.Text = "正确数据个数为:" + int_row3Point.ToString() + "个"
End If
End If
Next
End Sub
------解决方案--------------------
Dim myadapter3 As SqlDataAdapter = New SqlDataAdapter("select * from shuju where id in (" & strids & ")", conn)
端点下在这里,看sql是什么,然后返回的数据是不是你的预期。