Microsoft Knowledge Base Email Alertz

KBAlertz.com: When you use the AppWizard to create a CRecordset class using the ODBC Text Driver, your project will compile. However, when you try to open the recordset, you will get the following error message:

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **


Community Site



We Send hundreds of thousands of emails using ASP.NET Email


ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 177947 - Last Review: June 2, 2005 - Revision: 3.0

You receive a "Syntax error in FROM clause" error message when you use the AppWizard to create a CRecordset class by using the ODBC Text Driver in Visual C++

This article was previously published under Q177947

On This Page

SYMPTOMS

When you use the AppWizard to create a CRecordset class using the ODBC Text Driver, your project will compile. However, when you try to open the recordset, you will get the following error message:
Syntax error in FROM clause.

CAUSE

The AppWizard incorrectly parses the table as [Table].[txt], instead of as [Table#txt].

RESOLUTION

In the CTextDriverSet.cpp implementation file, find the CTextDriverSet::GetDefaultSQL() function and change the return value from
   return _T("[Table].[txt]");
				
to the following:
   return _T("[Table#txt]");
					
Here is the function before the changes:
   CString CTextDriverSet::GetDefaultSQL()
   {
      return _T("[Table].[txt]");

   }
				
Here is the function after the changes:
   CString CTextDriverSet::GetDefaultSQL()
   {
      return _T("[Table#txt]");
   }
				

STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

In Notepad

  1. Create a text file with the following content:
          Field1,Field2
          1,abc
    						
  2. Save this file as Table.txt and close it.
  3. Create a new User DSN based on the Microsoft Text Driver and name it TextDriverSample.
  4. Clear the Use Current Directory box.
  5. Click the Select Directory button and select the directory that contains Table.txt.
  6. Click Options.
  7. Select *.txt from the Extensions list box.
  8. Click the Define Format button.
  9. Select Table.txt.
  10. Select the Column Name Header box.
  11. From the Format combo box, select CSV Delimited.
  12. Click the Guess button.
  13. Save and exit the ODBC Manager.

Start Visual C++ 5.0 or Visual C++ 6.0

  1. Create a new MFC application.
  2. Select Single Document, then click Next.
  3. Select Database View Without File Support.
  4. Click the Data Source button.
  5. From the ODBC combo box, select TextDriverSample, then click OK.
  6. From the Database Tables list, select Table.txt.
  7. Click OK, then click Finish.
  8. Compile the project.

APPLIES TO
  • Microsoft Data Access Components 2.5, when used with:
    • Microsoft Visual C++ 6.0 Enterprise Edition
    • Microsoft Visual C++ 5.0 Enterprise Edition
    • Microsoft Visual C++ 5.0 Professional Edition
    • Microsoft Visual C++ 6.0 Professional Edition
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
Keywords: 
kberrmsg kbtshoot kbdatabase kbprb kbmdacnosweep KB177947
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please