记录集对象中的vb 6.0错误 [英] vb 6.0 error in recordset object
问题描述
昏暗作为新的ADODB.Recordset
如果rs.State = 1,则rs.Close
rs.Open从Deposite_Cheque_Master中选择m.DCH_Date,d.DCH_Date为m,将Deposite_Cheque_Detail选择为d,其中m.DCH_Id = d.DCH_Id和m.DCH_Id = 1",cn,adOpenDynamic,adLockOptimistic
''================================== MS Access中的数据库有效时======== =========
Debug.Print rs.Fields("m.DCH_Date")
''================================================ ============
''=================================''在sql 2005中的数据库不起作用时==== ============
Debug.Print rs.Fields("m.DCH_Date")
''================================================ ============
请回复....
谢谢
in vb6.0
Dim rs As New ADODB.Recordset
If rs.State = 1 Then rs.Close
rs.Open "select m.DCH_Date ,d.DCH_Date from Deposite_Cheque_Master as m, Deposite_Cheque_Detail as d where m.DCH_Id =d.DCH_Id and m.DCH_Id = 1", cn, adOpenDynamic, adLockOptimistic
''================================== Works when database in MS Access =================
Debug.Print rs.Fields("m.DCH_Date")
''=============================================================
''================================== doesn''n Work when database in sql 2005 =================
Debug.Print rs.Fields("m.DCH_Date")
''=============================================================
pls reply....
Thank you
推荐答案
首先检查rs.BOF和rs.EOF,因为如果两个都为true,则记录集为空.如果不是,请调用rs.MoveFirst明确显示第一个记录.
另外,请使用断点检查连接等,并观察变量以确保它们已正确初始化.
祝你好运!
First check rs.BOF and rs.EOF because if both are true, the recordset is empty. If not, call rs.MoveFirst to explicitly go t the first record.
Also, check the connection etc. using breakpoints and watch variables to make sure they are initialized okay.
Good luck!
这篇关于记录集对象中的vb 6.0错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!