关于vb数据select 一次查询好需要的内容,在分别赋值?
用select统计数据满足条件的记录数,然后分别赋值给text,用以下代码SQL="select*fromzhiliangwhere类型like'%张%'"SetRS=T...
用select统计数据满足条件的记录数,然后分别赋值给text,用以下代码
SQL = "select * from zhiliang where 类型 like '%张%'"
Set RS = TransactSQL(SQL)
Text2.Text = RS.RecordCount
RS.Close
SQL = "select * from zhiliang where 类型 = '业务部'"
Set RS = TransactSQL(SQL)
Text3.Text = RS.RecordCount
RS.Close
SQL = "select * from zhiliang where 类型 = '市场部'"
Set RS = TransactSQL(SQL)
Text4.Text = RS.RecordCount
RS.Close
等等,几十条
之前见过把sql语句放一起,全部查询完后再给text赋值,但忘了怎么写了?或者谁知道这种统计有没有更好的方法?给点代码学习下,谢谢 展开
SQL = "select * from zhiliang where 类型 like '%张%'"
Set RS = TransactSQL(SQL)
Text2.Text = RS.RecordCount
RS.Close
SQL = "select * from zhiliang where 类型 = '业务部'"
Set RS = TransactSQL(SQL)
Text3.Text = RS.RecordCount
RS.Close
SQL = "select * from zhiliang where 类型 = '市场部'"
Set RS = TransactSQL(SQL)
Text4.Text = RS.RecordCount
RS.Close
等等,几十条
之前见过把sql语句放一起,全部查询完后再给text赋值,但忘了怎么写了?或者谁知道这种统计有没有更好的方法?给点代码学习下,谢谢 展开
展开全部
执行SQL = "select * from zhiliang",获得的结果,滑首旅芹卜再逐条分析,例如:
SQL = "select * from zhiliang'"
Set RS = TransactSQL(SQL)
RS.MoveFirst
do
a = RS.Fields("类型").Value
select case a
case "信凳业务部"
Text3.Text = Val(Text3.Text ) + 1
case "市场部"
Text4.Text = Val(Text4.Text ) + 1
............
RS.MoveNext
Loop While Not RS.EOF
SQL = "select * from zhiliang'"
Set RS = TransactSQL(SQL)
RS.MoveFirst
do
a = RS.Fields("类型").Value
select case a
case "信凳业务部"
Text3.Text = Val(Text3.Text ) + 1
case "市场部"
Text4.Text = Val(Text4.Text ) + 1
............
RS.MoveNext
Loop While Not RS.EOF
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询