dim conn as new adodb.connection dim rs as new adodb.recordset conn.connectionstring="..." '与数据库的连接语句 conn.open if rs.state=adstaetopen then rs.close rs.open "select fnum,fprice,fnum*fprice as fmoney from salary",conn,adopenkeyset,adlockreadonly if rs.recordcount>0 then text1.text=format(rs!fmoney,"###0.00") end if rs.close set rs=nothing'如果记录集有多行,则可用msflexgrid控件来显示数据 rs.open "select fnum,fprice,fnum*fprice as fmoney from salary",conn,adopenkeyset,adlockreadonly set msflexgrid1.datasource=rs rs.closes set rs=nothing
dim conn as new adodb.connection dim rs as new adodb.recordset conn.connectionstring="..." '与数据库的连接语句 conn.open if rs.state=adstaetopen then rs.close 不好意思,盗版楼上一下 ^-^ 总金额 rs.open "select sum(单价 * 数量 ) as sum_price from salary",conn,adopenkeyset,adlockreadonly text1.text=format(rs!sum_price,"0.00")
dim rs as new adodb.recordset
conn.connectionstring="..." '与数据库的连接语句
conn.open
if rs.state=adstaetopen then rs.close
rs.open "select fnum,fprice,fnum*fprice as fmoney from salary",conn,adopenkeyset,adlockreadonly
if rs.recordcount>0 then
text1.text=format(rs!fmoney,"###0.00")
end if
rs.close
set rs=nothing'如果记录集有多行,则可用msflexgrid控件来显示数据
rs.open "select fnum,fprice,fnum*fprice as fmoney from salary",conn,adopenkeyset,adlockreadonly
set msflexgrid1.datasource=rs
rs.closes
set rs=nothing
dim rs as new adodb.recordset
conn.connectionstring="..." '与数据库的连接语句
conn.open
if rs.state=adstaetopen then rs.close
不好意思,盗版楼上一下 ^-^
总金额
rs.open "select sum(单价 * 数量 ) as sum_price from salary",conn,adopenkeyset,adlockreadonly
text1.text=format(rs!sum_price,"0.00")