error in GetDefaultSQL 
Author Message
 error in GetDefaultSQL

I am getting the message:

The Microsoft Jet database engine cannot find the input
table or query 'Plot_Accounting,Queues,Plotters'. Make
sure it exists and that its name is spelled correctly.

when making a CRecordSet Open of:

m_Report.Open
(CRecordset::snapshot,NULL,CRecordset::readOnly);

The recordset has a GetDefaultSQL rewritten as:

return _T("[Plot_Accounting,Queues,Plotters]");

with a GetDefaultConnect  as:

return _T("ODBC;DSN=Plot_Accounting");

to return a join on these tables. They are all in the same
datasource(I used the ClassWizard's UpdateColumns to
select the tables), and I've rechecked the spelling. I am
using an Access database and using C++ v5. What am I
missing?

Thanks for any help,
Stephanie



Sat, 09 Oct 2004 20:17:00 GMT  
 error in GetDefaultSQL

Quote:

>I am getting the message:

>The Microsoft Jet database engine cannot find the input
>table or query 'Plot_Accounting,Queues,Plotters'. Make
>sure it exists and that its name is spelled correctly.

>when making a CRecordSet Open of:

>m_Report.Open
>(CRecordset::snapshot,NULL,CRecordset::readOnly);

>The recordset has a GetDefaultSQL rewritten as:

>return _T("[Plot_Accounting,Queues,Plotters]");

>with a GetDefaultConnect  as:

>return _T("ODBC;DSN=Plot_Accounting");

>to return a join on these tables. They are all in the same
>datasource(I used the ClassWizard's UpdateColumns to
>select the tables), and I've rechecked the spelling. I am
>using an Access database and using C++ v5. What am I
>missing?

I think you'll find the query won't work in Access, either. Three
things spring to mind:
1. Your recordset must have variables (in the DoDataExcahange) in the
order the query returns them
2. Access tens to use "inner join on" etc. for table joins
3. You should return a valid SQL string from the GetDefaultSQL()
method unless it's a simple table name.

Have you tried looking at the SQL string generated? This may help.(Use
GetSQL()).

HTH

Paul
-------------------------------------------
Expressed opinions are usually my own.
Especially if they're any good (of course).
-------------------------------------------



Sun, 10 Oct 2004 19:23:44 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Bug in MFC v.5 - CRecordset::Open using CLongBinary and GetDefaultSQL() override

2. GetDefaultSQL()

3. Bug in MFC v.5 - CRecordset::Open using CLongBinary and GetDefaultSQL() override

4. error, error, error !!!

5. GetDefaultSql to access a table within an Excel File ??

6. fatal error C1001: INTERNAL COMPILER ERROR

7. fatal error C1001: INTERNAL COMPILER ERROR

8. vs.net + lnk2019 error +lnk 1120 error

9. fatal error C1001: INTERNAL COMPILER ERROR

10. fatal error C1001: INTERNAL COMPILER ERROR

11. fatal error C1001: INTERNAL COMPILER ERROR

12. Error C2061: Syntax Error

 

 
Powered by phpBB® Forum Software