VB6.0 实时错误“3704”,对象关闭时,不允许操作。

PrivateSubcmdInquire_Click()DimtxtsqlAsStringDimMsgTextAsStringDimdd(4)AsBooleanDimmr... Private Sub cmdInquire_Click()
Dim txtsql As String
Dim MsgText As String
Dim dd(4) As Boolean
Dim mrc As New ADODB.Recordset

txtsql = "select * from cx_view where "

txtsql = txtsql & " order by CSn "
conn.Execute (txtsql)

With MSFlexGrid1
.Rows = 2
.CellAlignment = 4
.TextMatrix(1, 0) = "工号"
.TextMatrix(1, 1) = "部门"
.TextMatrix(1, 2) = "姓名"
.TextMatrix(1, 3) = "岗位"
.TextMatrix(1, 4) = "联系电话"
.TextMatrix(1, 5) = "性别"
.TextMatrix(1, 6) = "运营商"
.TextMatrix(1, 7) = "使用时间"
.TextMatrix(1, 8) = "电脑编号"
.TextMatrix(1, 9) = "品牌"
.TextMatrix(1, 10) = "型号"
.TextMatrix(1, 11) = "出厂编号"
.TextMatrix(1, 12) = "MAC地址"
.TextMatrix(1, 13) = "IP地址"
.TextMatrix(1, 14) = "联网信息"
.TextMatrix(1, 15) = "验货人"
.TextMatrix(1, 16) = "验货时间"
.TextMatrix(1, 17) = "维修信息"

Do While Not mrc.EOF
.Rows = .Rows + 1
.CellAlignment = 4
.TextMatrix(.Rows - 1, 0) = mrc.Fields(0)
.TextMatrix(.Rows - 1, 1) = mrc.Fields(1)
.TextMatrix(.Rows - 1, 2) = mrc.Fields(2)
.TextMatrix(.Rows - 1, 3) = mrc.Fields(3)
.TextMatrix(.Rows - 1, 4) = mrc.Fields(4)
.TextMatrix(.Rows - 1, 5) = mrc.Fields(5)
.TextMatrix(.Rows - 1, 6) = mrc.Fields(6)
.TextMatrix(.Rows - 1, 7) = Format(mrc.Fields(7), "yyyy-mm-dd")
.TextMatrix(.Rows - 1, 8) = mrc.Fields(8)
.TextMatrix(.Rows - 1, 9) = mrc.Fields(9)
.TextMatrix(.Rows - 1, 10) = mrc.Fields(10)
.TextMatrix(.Rows - 1, 11) = mrc.Fields(11)
.TextMatrix(.Rows - 1, 12) = mrc.Fields(12)
.TextMatrix(.Rows - 1, 13) = mrc.Fields(13)
.TextMatrix(.Rows - 1, 14) = mrc.Fields(14)
.TextMatrix(.Rows - 1, 15) = mrc.Fields(15)
.TextMatrix(.Rows - 1, 16) = Format(mrc.Fields(16), "yyyy-mm-dd")
.TextMatrix(.Rows - 1, 17) = mrc.Fields(17)
mrc.MoveNext
Loop

End With

mrc.Close

End Sub
展开
 我来答
intehel
2012-10-26 · TA获得超过1293个赞
知道大有可为答主
回答量:1601
采纳率:100%
帮助的人:1766万
展开全部
conn.Execute (txtsql)

修改为
mrc.ActiveConnection = conn
mrc.open txtsql
mrc.MoveFirst
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式