如何将 RECORDSET 的内容逐条显示在MSFLEXGRID里?!

tercel001 2003-10-20 10:55:06
请问该如何实现
谢谢
...全文
63 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
imur 2003-10-22
  • 打赏
  • 举报
回复
学习
0759 2003-10-21
  • 打赏
  • 举报
回复
up
leo4587 2003-10-21
  • 打赏
  • 举报
回复
這是我常用的方法,希望能幫你解決問題。

Public conn As New ADODB.Connection
Public rs1 As New ADODB.Recordset
Public g_sql As String

if rs1.state=1 then rs1.close
g_sql="select * from table_name"
rs1.open g_sql,conn,3,1
with msflexgrid
for i=1 to rs1.recordcount
.textmatrix(i,0)=iif(isnull(rs1("字段1")),"",rs1("字段1")
.textmatrix(i,1)=iif(isnull(rs1("字段2")),"",rs1("字段2")
.
.
.
.textmatrix(i,n)=iif(isnull(rs1("字段n+1")),"",rs1("字段n+1")
rs1.movenext
.rows=.rows+1
next i
end with
trite 2003-10-21
  • 打赏
  • 举报
回复
Set rst = New ADODB.Recordset
rst.Open Trim$(SQL), cnn, adOpenKeyset, adLockOptimistic
with msflexgrid1
.rows=1 '第一列为表头,赋值与下面的类似
do while not rst.eof
.rows=.rows+1
.textmatrix(.rows-1,0)=rst.fields(0)
.textmatrix(.rows-1,1)=rst.fields(1)
'..........有几个字段就写几条
rst.movenext
loop
end with

lop008 2003-10-20
  • 打赏
  • 举报
回复
说的具体一点!是循环显示,还是追加显示,还是就一条显示。
abc10 2003-10-20
  • 打赏
  • 举报
回复

Set Adores = New Recordset
Adores.Open "select * from tab1", cn, adOpenStatic, adLockOptimistic

Set MSHFlexGrid1.DataSource = Adores
tercel001 2003-10-20
  • 打赏
  • 举报
回复
将recordset的内容一条条的完全显示出来就可以了
另外,怎么样可以把recordset的内容一行行的读入文本文件
一条记录占一行

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧