Click to See Complete Forum and Search --> : Error Opening a Recordset
Gustavo Lermen
May 7th, 1999, 10:12 AM
I'm trying to open a CRecordset passing an SQL string and I get the folowing error:
"No Columns were found to calling SQLFetchScroll/SQLExtendedFetch"
Sugestions?
davidramsey
May 8th, 1999, 11:26 AM
If you can post the quey that you are passing I will take a look. It is probably syntax in the string.
TKE Dave
Gustavo Lermen
May 10th, 1999, 02:22 PM
Hi...
This is the code:
CDatabase mdb;
mdb.Open("ODBC;DSN=ODBC_GEO");
CRecordset rs2(&mdb);
CString SQL = "Select * from Equipamentos"; //Equipamentos is an Access 97 //table
rs2.Open(AFX_DB_USE_DEFAULT_TYPE,SQL,CRecordset::none);
//Here the error occurs....
Thanks for the atention.....
davidramsey
May 10th, 1999, 06:34 PM
Just a couple of quick things to check.
What is the default type of the recordset?
Have you checked the spelling of the table names(I am sure that you have).
Is the database always an Access database?
If so, have you considered using DAO?
Can you exhibit the same behavior through DAO?
If not, you may want to check the setup of the ODBC datasource.
Are you using Microsoft's ODBC pack or is it third party?
At first glance it looks like the syntax is correct, I would almost have to step through the code to know for sure. If you are still stumped, you can zip up the project and send it to me. I am running VC 6.0 with Access 97 and the latest MDAC install. Sorry I couldn't see the problem from your post.
If you need my e-mail address post a message here and I will send it to you.
God Luck
TKE Dave
Gustavo Lermen
May 12th, 1999, 01:28 PM
Hi again.....
I'll try to answer your questions.
1) The default type is snapshot(I think).
2) Yes, the spelling of the table name is correct.
3) No, the database is not always an Access table.
4) Yes I'm using Microsoft ODBC pack version 3.0.
If you send me your e-mail I can send the project to you. I'm using VC 5.0 with Access 97.
Thanks again.
Your problem is that you are trying to open a CRecordset object. You should derive a class from CRecordset and Open it instead. You can't use a CRecordset in the context of your code.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.