冷情王爷下堂妻大结局:如何显示SQL记录总和。

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 23:12:08
用的是.net,SQL2000。比如数据库中有18条记录。
如何在WEB页面中显示:总记录数为18条。

请说详细一点。

Sub FillColumn(fg As vsFlexGrid, ByVal c As Long, ByVal t As String, ByVal s As String)

Dim r&, i&, cnt&
ReDim lst(0) As String

' build list
cnt = 0
i = InStr(s, "|")
While i > 0
lst(cnt) = left(s, i - 1)
s = Mid(s, i + 1)
cnt = cnt + 1
ReDim Preserve lst(cnt) As String
i = InStr(s, "|")
Wend
lst(cnt) = s

' set values
fg.Cell(flexcpText, 0, c) = t
For r = fg.FixedRows To fg.Rows - 1
i = (Rnd() * 1000) Mod (cnt + 1)
fg.Cell(flexcpText, r, c) = lst(i)
Next

' do an autosize
fg.AutoSize c, , , 300
End Sub

FillColumn hfxgrid ""Proposals|Demos|Social|Trips|Projects""

或者试下另一种方法:

sql = "select mobilename,mobiletype,count(*) " & _
"as sellcount,count(mobilename)/ ( select count(*) " & _
" from mobile where sellplace<>'其他' and buydate between #" & _
DTPFromDate.Value & "# and #" & DTPTodate.Value & "#)" & _
" as sellpercent " & _
"from mobile where buydate between #" & _
DTPFromDate.Value & "# and #" & DTPTodate.Value & "#" & _
"group by mobilename,mobiletype " & _
" order by count(*) desc "
统计好了用grid控件显示就好