vb.net sql的查询的问题 !!!
If conn.State = ConnectionState.Closed Then conn.Open()
sqltmpstr = "select UserID from tempUser" //表里有大量的数据
ds = OleDBHandle.GetOleDataSet(sqltmpstr, "temp0", conn)
If ds.Tables("temp0").Rows.Count > 0 Then //例如:循环20次
For i = 0 To ds.Tables("temp0").Rows.Count - 1
id = ds.Tables("temp0").Rows(i)("UserID") // 先取到id 作为下一个表查询的条件 不知道为什么出错
sqlstr = "select * from TotalReport where Uid='" & id & "'"
ds = OleDBHandle.GetOleDataSet(sqlstr, "temp1", conn)
If ds.Tables("temp1").Rows.Count > 0 Then
esuper = ds.Tables("temp1").Rows(0)("superTotal")
egood = ds.Tables("temp1").Rows(0)("goodTotal")
enormal = ds.Tables("temp1").Rows(0)("normalTotal")
ebad = ds.Tables("temp1").Rows(0)("badTotal")
ctime = ds.Tables("temp1").Rows(0)("cardtime")
End If
sqlstr = "insert into DayReport (Uid,Uname,daytime,cardtime,superDay,goodDay,normalDay,badDay) values ('" & id & "','" & name & "','" & seartime & "','" & ctime & "','" & esuper & "','" & egood & "','" & enormal & "','" & ebad & "')"
OleDBHandle.ExecuteNonQuery(sqlstr, conn)
Next
上述的问题怎么解决??