查询如何显示在MSFlexGrid网格控件中的问题。救急!

kingpeacock 2004-07-22 07:22:44
我用了六个单选按钮(option)和一个checkbox,其中六个option分成两组,三个为一组,用于查询条件的控件。我想让根据不同的复合查询条件,查询出来的的结果显示在网格控件中。
条件结构是:
if option1.value=true then
if check1.value=1 and option4.value=true then
sql="查询语句1"
elseif check1.value=1 and option5.value=ture hen
sql="查询语句2"
elseif check1.value=1 and option6.value=ture hen
sql="查询语句3"
end if
elseif option2.value=true then
if check1.value=1 and option4.value=true then
sql="查询语句4"
elseif check1.value=1 and option5.value=ture hen
sql="查询语句5"
elseif check1.value=1 and option6.value=ture hen
sql="查询语句6"
end if
elseif option3.value=true then
if check1.value=1 and option4.value=true then
sql="查询语句7"
elseif check1.value=1 and option5.value=ture hen
sql="查询语句8"
elseif check1.value=1 and option6.value=ture hen
sql="查询语句9"
end if
同时:
Private Sub Form_Load()
Option4.Enabled = False
Option5.Enabled = False
Option6.Enabled = False
Combo5.Enabled = False
Combo6.Enabled = False
Combo7.Enabled = False
End Sub

Private Sub Check1_Click()
Option4.Enabled = Not Option4.Enabled
Option5.Enabled = Not Option5.Enabled
Option6.Enabled = Not Option6.Enabled
Combo5.Enabled = Not Combo5.Enabled
Combo6.Enabled = Not Combo6.Enabled
Combo7.Enabled = Not Combo7.Enabled
Combo8.Enabled = Not Combo8.Enabled
Combo8.Enabled = False
字段较多。
...全文
209 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
flyingZFX 2004-08-09
  • 打赏
  • 举报
回复
这个很容易呀,

你找点MsFlexGrid控件的帮助不就得了。

再说了,在CSDN里随便搜索一下,都会找到一大堆

http://community.csdn.net/Expert/topic/3106/3106615.xml?temp=.7684748
http://community.csdn.net/Expert/topic/3106/3106828.xml?temp=.9537317
http://community.csdn.net/Expert/topic/3108/3108592.xml?temp=.2008631
XmagicX 2004-08-08
  • 打赏
  • 举报
回复
MSFlexGrid网格控件 可以和data控件绑定

MSHFlexGrid网格控件 可以和Adodc控件绑定,还是推荐使用MSHFlexGrid
可以查询出来的的结果显示在网格控件
不绑定的话只能用TextMatrix一个一个添加了
sinall 2004-08-08
  • 打赏
  • 举报
回复
MSFlexGrid1.TextMatrix(行号(从0开始), 列号(从0开始)) = rs("字段名")
或者
MSFlexGrid1.Col = 行号(从0开始)
MSFlexGrid1.Row = 列号(从0开始)
MSFlexGrid1.Text = rs("字段名")
kingpeacock 2004-08-07
  • 打赏
  • 举报
回复
我的问题是样让查询出来的的结果显示在网格控件中?
talent303 2004-08-07
  • 打赏
  • 举报
回复
这些程序都对啊,,不过好像少了一个end if 吧了,,,
if option1.value=true then
if check1.value=1 and option4.value=true then
sql="查询语句1"
elseif check1.value=1 and option5.value=ture hen
sql="查询语句2"
elseif check1.value=1 and option6.value=ture hen
sql="查询语句3"
end if
elseif option2.value=true then
if check1.value=1 and option4.value=true then
sql="查询语句4"
elseif check1.value=1 and option5.value=ture hen
sql="查询语句5"
elseif check1.value=1 and option6.value=ture hen
sql="查询语句6"
end if
elseif option3.value=true then
if check1.value=1 and option4.value=true then
sql="查询语句7"
elseif check1.value=1 and option5.value=ture hen
sql="查询语句8"
elseif check1.value=1 and option6.value=ture hen
sql="查询语句9"
end if
end if
clark_rain 2004-08-06
  • 打赏
  • 举报
回复
dim cnn as new adodb.cennection
dim rs as new adodb.recordset
cnn.cennectionstring="....."
cnn.open
rs.open sql,cnn,4,2,adcmdtext
set mshflexgrid.recordset=rs
kingpeacock 2004-08-06
  • 打赏
  • 举报
回复
up

1,453

社区成员

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

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