Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

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!
 
Share this answer
 
Comments
kiran763425 12-Oct-11 1:48am    
There is Data in the DAtabase & Recordset has also fetched the data but when i access the field value by field name with table Alise the error occurs thet "Item Cannot be found" but in MS Accees it Works Fine when i i access the field value by field name with table Alise....
E.F. Nijboer 13-Oct-11 16:03pm    
Try add the following before rs.Open...
rs.CursorLocation = adUseClient
kiran763425 5-Nov-11 9:02am    
Same Error Has Occured !!!!
E.F. Nijboer 6-Nov-11 8:20am    
Couldn't it be the column name is misspelled or simply doesn't exists? Try to check the names and also check the case because it could be it is configured to be case sensitive.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900