PRB: "Syntax Error in FROM Clause" Using Text ODBC Driver
ID: Q177947
|
The information in this article applies to:
-
Microsoft Visual C++, 32-bit Editions, versions 5.0, 6.0
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
- Create a text file with the following content:
Field1,Field2
1,abc
- Save this file as Table.txt and close it.
- Create a new User DSN based on the Microsoft Text Driver and name it
TextDriverSample.
- Clear the Use Current Directory box.
- Click the Select Directory button and select the directory that contains
Table.txt.
- Click Options.
- Select *.txt from the Extensions list box.
- Click the Define Format button.
- Select Table.txt.
- Select the Column Name Header box.
- From the Format combo box, select CSV Delimited.
- Click the Guess button.
- Save and exit the ODBC Manager.
Start Visual C++ 5.0 or Visual C++ 6.0
- Create a new MFC application.
- Select Single Document, then click Next.
- Select Database View Without File Support.
- Click the Data Source button.
- From the ODBC combo box, select TextDriverSample, then click OK.
- From the Database Tables list, select Table.txt.
- Click OK, then click Finish.
- Compile the project.
Additional query words:
Bomb Error kbvc500 kbvc600
Keywords : kbDatabase kbMFC kbODBC kbVC
Version : WINNT:5.0,6.0
Platform : winnt
Issue type : kbprb