怎么传递数组里面所有值到查询语句,如程序所示.查询结果都绑定到datalist里
如何传递数组里面所有值到查询语句,如程序所示.查询结果都绑定到datalist里
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim total_topic_num As Integer = 12
Dim test_topic_num As Integer = 5
Dim interval As Integer = total_topic_num \ test_topic_num
Dim big_interval_num As Integer = total_topic_num Mod test_topic_num
Dim array_topic_id(test_topic_num) As Integer
Dim i As Integer = 0
If big_interval_num <> 0 Then
For i = 0 To test_topic_num - 1 - big_interval_num
Randomize()
array_topic_id(i) = Int(interval * Rnd() + i * interval)
Session("id") = array_topic_id(i)用这个传值只能传数组里最后一个值
Next
For i = test_topic_num - big_interval_num To test_topic_num - 1
Randomize()
array_topic_id(i) = (test_topic_num - big_interval_num) * interval + Int((interval + 1) * Rnd() + (i - (test_topic_num - big_interval_num)) * (interval + 1))
Session("id") = array_topic_id(i)用这个传值只能传数组里最后一个值
Next
Else
For i = 0 To test_topic_num - 1
Randomize()
array_topic_id(i) = Int(interval * Rnd() + i * interval)
Session("id") = array_topic_id(i)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim total_topic_num As Integer = 12
Dim test_topic_num As Integer = 5
Dim interval As Integer = total_topic_num \ test_topic_num
Dim big_interval_num As Integer = total_topic_num Mod test_topic_num
Dim array_topic_id(test_topic_num) As Integer
Dim i As Integer = 0
If big_interval_num <> 0 Then
For i = 0 To test_topic_num - 1 - big_interval_num
Randomize()
array_topic_id(i) = Int(interval * Rnd() + i * interval)
Session("id") = array_topic_id(i)用这个传值只能传数组里最后一个值
Next
For i = test_topic_num - big_interval_num To test_topic_num - 1
Randomize()
array_topic_id(i) = (test_topic_num - big_interval_num) * interval + Int((interval + 1) * Rnd() + (i - (test_topic_num - big_interval_num)) * (interval + 1))
Session("id") = array_topic_id(i)用这个传值只能传数组里最后一个值
Next
Else
For i = 0 To test_topic_num - 1
Randomize()
array_topic_id(i) = Int(interval * Rnd() + i * interval)
Session("id") = array_topic_id(i)