vb.net sql的查询的问题 !!!

shen_wei shen_wei 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

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

上述的问题怎么解决??
...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
shen_wei
VB 16,718 成员 110,520 内容