求一段vb代码(,答案)
求一段vb代码(高手请进,在线等答案)
select b.xmxh,a.ssfb,sum(a.gcl*a.zhdj) from TblDEFXGC a,TblDEFXGC b where a.gcxh=10806 and
a.gcxh=b.gcxh and a.ssfb=b.xmxh and (a.lb=2 or a.lb=3) and b.lb=0 and a.xh not like '%设备%' group by b.xmxh,a.ssfb
以上是查询的sql语句
我想要一个方法 可以返回上面sql语句的查询结果——单行单列的表
并且是需要有参数,即gcxh。
另外我希望可以读取其中的sum(*),用在显示页面上的文本框内。
另外 如果有更搞笑 更便捷的方法也行。
谢谢 ! 如果我的程序测试通过 ,分数即刻送上。
在线等!!!
------解决方案--------------------
围观一下…………
------解决方案--------------------
select b.xmxh,a.ssfb,sum(a.gcl*a.zhdj) from TblDEFXGC a,TblDEFXGC b where a.gcxh=10806 and
a.gcxh=b.gcxh and a.ssfb=b.xmxh and (a.lb=2 or a.lb=3) and b.lb=0 and a.xh not like '%设备%' group by b.xmxh,a.ssfb
以上是查询的sql语句
我想要一个方法 可以返回上面sql语句的查询结果——单行单列的表
并且是需要有参数,即gcxh。
另外我希望可以读取其中的sum(*),用在显示页面上的文本框内。
另外 如果有更搞笑 更便捷的方法也行。
谢谢 ! 如果我的程序测试通过 ,分数即刻送上。
在线等!!!
------解决方案--------------------
围观一下…………
------解决方案--------------------
- VB code
public function yigelei(byval pszgcxh as integer ) as Recordset dim rs as adodb.recordset Dim con As New RTConnection dim szsql as string 'pszgcxh =10806 con.ConnectionString = ConnectionStr'ConnectionStr 为数据库连接配置 自己写~ szsql="select b.xmxh,a.ssfb,sum(a.gcl*a.zhdj) from TblDEFXGC a,TblDEFXGC b where a.gcxh=" & pszgcxh & " and a.gcxh=b.gcxh and a.ssfb=b.xmxh and (a.lb=2 or a.lb=3) and b.lb=0 and a.xh not like '%设备%' group by b.xmxh,a.ssfb " rs=con.Execute(szSql) 'rs就是返回的数据集 rs!字段名 就是你返回的字段数据 end function
------解决方案--------------------
什么数据库?
------解决方案--------------------
Friendly UP!
------解决方案--------------------
来看看
------解决方案--------------------
我,来围观的……