you should use sql to find the same number between the two table
then use for or do to write the value you get!
the sql just like so:
select * from test1 inner join test2 on test1.testid=test2.testid
then use for or do to write the value you get!
the sql just like so:
select * from test1 inner join test2 on test1.testid=test2.testid
读取数据库表A,将结果集如1,2,3,4,5... 赋给一个一维数组myarray1,过程2:
读取另外一个数据库表B,取出值,一个个判断这个值是不是和myarray1中的值相等,如果相等,Response.write("1")。这么两个过程,请教!
用数组的思路会好一点。if you use array you must connect the database again and again!i think you should use query!
表B 字段: bid,bb,aid
就以DataGrid绑定数据表B显示为例吧,要根据情况改变DataGrid某一列的显示值,如果表A中有这一列DataKey即aid的记录,那么第三列显示“是”,用数组,不必在DataGrid每一行输出值时都去连接数据库进行子查询,
而只需去判断一下数组中是不是有这个aid就够了,而做数组赋值操作只需一次读取表A就够了,那么是不是效率要高呢?好了,继续请教!哪位指点一下前面我说的过程怎么做?谢谢!
Protected arrtime() As DateTime '存放时间的数组(可变维)
For j = 0 To Me.dsbig.Tables("T217").Rows.Count - 1
'定义数组
ReDim arrtime(DateDiff(DateInterval.Day, CDate(Me.startdate), CDate(Me.enddate)))
For i = 0 To DateDiff(DateInterval.Day, CDate(Me.startdate), CDate(Me.enddate))
arrtime(i) = DateAdd(DateInterval.Day, i, Me.startdate)
next
next