本文介绍了在msflexgrid中执行查询和显示记录时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ms-access数据库在vb6.0中制作项目,我正在运行查询以在msflexgrid中显示记录.rs1.Open "select cname, desg, division,dept,ministry From data_detail where country=''" & cmbcontry.Text & "'' GROUP BY cname, desg, division,dept,ministry HAVING Count(*)>1 ", con, adOpenStatic, adLockOptimistic, adOpenKeyset
但它显示以下错误Item cannot be found in the collection corresponding to the requested name or ordinal
我正在使用组合框选择国家/地区,并在网格中显示其相应的记录.
我使用以下代码
如果 rs1.RecordCount> 0 然后 rs1.MoveFirst 同时(rs1.EOF = 错误) trec = trec + 1 rs1.MoveNext 前进 结束 如果 trec = 6 Mf1.Rows = rs1.RecordCount + 1 Mf1.Cols = 6 Mf1.Row = 0 Mf1.Col = 1 Mf1.Text = " CName" Mf1.Row = 0 Mf1.Col = 2 Mf1.Text = " 名称" Mf1.Row = 0 Mf1.Col = 3 Mf1.Text = " 除" Mf1.Row = 0 Mf1.Col = 4 Mf1.Text = " 部门" Mf1.Row = 0 Mf1.Col = 5 Mf1.Text = " 事工" 对于 i = 0 >到 rs1.RecordCount - 1 rs1.MoveFirst rs1.移动我 Mf1.Row = i + 1 ' 对于rl = 1到rs1.RecordCount ' 对于dup = 2到rs1.RecordCount ' 如果(r1!= dup)然后 Mf1.Col = 1 Mf1.Text = rs1.Fields( 9 )//在此我遇到此错误 Mf1.Col = 2 Mf1.Text = rs1.Fields( 10 ) Mf1.Col = 3 Mf1.Text = rs1.Fields( 11 ) Mf1.Col = 4 Mf1.Text = rs1.Fields( 12 ) Mf1.Col = 5 Mf1.Text = rs1.Fields( 13 ) rs1.MoveNext 下一步 对于 i = 1 要 Mf1. 对于 j = 0 到 Mf1. - 1 Mf1.Row = i- 1 Mf1.Col = j 下一步 下一步
我的目的是要找到相同的记录并将其显示在网格中.
请给我错误的地方打电话给我.
在此先感谢....
解决方案
这篇关于在msflexgrid中执行查询和显示记录时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!