Odbc Text Driver Syntax Error In From Clause
Contents |
(troubleshooting) Problem(Abstract) Problem Number Error Error number -3989587 DMS-E-GENERAL, A General Exception has occurred during worldship odbc error state 37000 error microsoft odbc text driver syntax error in from clause operation 'prepare request'. DMS-E-DBPARSER, The underlying database detected an error during
Syntax Error In From Clause Excel
processing of the SQL request. [Microsoft][ODBC Text Driver] Syntax error in FROM clause. when querying an
Error 42000 Microsoft Odbc Text Driver Syntax Error In From Clause
ODBC datasource using the Microsoft ODBC Text Driver. Solution Description This error is due to an issue with the ODBC driver. Microsoft have documented this issue in
Syntax Error In From Clause Access
their Knowledge Base articles #Q124322, Q125959 and Q124319. Please contact Microsoft for further information on this issue. As a workaround it may be possible to Qualify the Tables Less in the Catalog Tables dialog window. It may also be necessary to change the delimiter type in the ODBC drivers options, and to use Escape Metacharacters when retrieving the data. This option is also set in the Options for the ODBC driver. The problem is due to the driver not supporting quoted schema's or tables thus to eliminate the problem the attach must be made using the connection parameter DELIMIT=COL. Microsoft offers the following as a workaround. Please contact Microsoft for further information on this technique. These workarounds are not set within Impromptu but are for the Driver. Method 1: Name the range something other than "Database" or "Table." Method 2: If you are accessing data from a Microsoft Excel 5.0 workbook that contains a global range named "Database" or "Table," define it as a local range name, such as "Sheet1!Database." Note that making the name a local one will cause the table name to be displayed with the sheet name and then the range name: Sheet1!Database. Method 3: Add brackets ([) around the words "Database" or "Table." For example, to select all records fro
caused by something not that complex. As the case always is once you have the solution. So I thought I would share some of the things that I've come across, and hopefully tha {"Syntax error in FROM clause."} when using text based datasources ★★★★★★★★★★★★★★★ Michael Aspengren - MSFTJuly 17, 20080 Share 0 0 This is also one of the issues that I have seen a few times. What happens here is that customer uses *.csv or *.xls or any text file as a data source and connects to it using .Net and OleDb. http://www.ibm.com/support/docview.wss?uid=swg21352053 The error reported from the framework when issuing a SELECT is: {"Syntax error in FROM clause."} The most common reason for this is that the *.csv or *.xls file name contains a space. No space and all is well. The reason for this is that the file name is the table name, and as such, no spaces are allowed and should be enclosed in square brackets ie. [table https://blogs.msdn.microsoft.com/spike/2008/07/17/syntax-error-in-from-clause-when-using-text-based-datasources/ name]. Let’s show by example. Create a *.csv file in C:\Temp with the following content. CID;FNAME;LNAME 1;John;Smith 2;Peter;Johnson 3;Steve;Lloyd Then save it as Test.csv and then as Test Test.csv. Create a new .Net console application and just edit the Program.cs file to look like this. using System; using System.Text; using System.Data.OleDb; using System.Data; class Program { static void Main(string[] args) { // With space string fName = @"C:\Temp\Test Test.csv"; // Without space //string fName = @"C:\Temp\Test.csv"; // Get the dir out of the full path. string path = fName.Substring(0, fName.LastIndexOf(@"\")); string cString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties='text;HDR=Yes;FMT=CSVDelimited'"; OleDbConnection oc = new OleDbConnection(cString); oc.Open(); // Get the file out of the full path. int pos = fName.LastIndexOf(@"\") + 1; string tablename = fName.Substring(pos, fName.Length - pos); // This will work with spaces and without spaces in filename, // this is because the tablename will be now enclosed in square brackets. OleDbCommand ocmd = new OleDbCommand("SELECT * FROM [" + tablename + "]", oc); // Running the select will result in: // {"Syntax error in FROM clause."}
Uncategorized on January 6, 2006. The company for whom I now work buys some version of Microsoft Office that includes Powerpoint and Publisher, but not Access. I'd be more specific, but I don't really know what the versions of Office are. But no Access? I need to figure out http://dailydoseofexcel.com/archives/2006/01/06/syntax-error-in-from-clause/ a way to fix that! In the mean time, I've downloaded Nwind.mdb from Office Online, http://stackoverflow.com/questions/21590799/c-sharp-dbf-error-opening which I assume is the same as the Northwind.mdb sample database that ships with Access. When I attempt to create an external data query in Excel 2003, I get this message at the end of the query wizard: I don't typically use the query wizard, but I got the same error message in the MS Query interface when I tried to syntax error add a field by dragging it from the tables area to the query area. Furthermore, I got the same error when I tried to manually enter this SQL statement: SELECT * FROM Categories I'm not quite sure how I figured this next one out, but the problem was fixed by manually entering (manually means in the SQL dialog box from within MS Query): SELECT * FROM [Categories] I wasn't able to avoid the error using any kind syntax error in GUI - it had to be manually typed. When I use ADO via VBA, I'm not required to enclose the table name in brackets in any SQL statements I write. The connection statement I use to connect via ADO is exactly the same as the Connection property of the QueryTable object except that the ODBC is removed from the front of it. Does that mean the ODBC driver is the problem? Why do I have an ODBC driver for Access if I don't have Access installed? Is it time to learn MySQL so I don't have to pay for Access? By Dick Kusleika in Uncategorized on January 6, 2006. 18 Replies Post navigation ← Conditional Formatting and Noncontiguous Ranges ExcelKBs Forum → 18 thoughts on “Syntax Error in FROM Clause” doco January 6, 2006 at 7:48 pm MySQL would be an interesting touch to DDE… :) doco January 6, 2006 at 7:57 pm Seriously, I have had other problems with MSQ. I just finished a project which had need for a SELECT * FROM table WHERE(((date)=#" & dateFromWrkSht & "#));" The date field in the Access table was formated "Short Date". The date from the worksheet was formatted "Short Date"; still the two were not compatable and would not recognize each other. I believe because Time is appended to the date in the worksheet. My workaround was
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up C# DBF Error Opening up vote 0 down vote favorite I am trying to write a program to read a DBF file and put it into a datatable. I don't have much experience working with FoxPro database. Below is the funcation that opens the dbf. I pass the filename into the function. private DataTable loadFile(string FileName) { System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection(); conn.ConnectionString = "DRIVER={Microsoft dBase Driver (*.dbf)};Deleted=1"; DataTable dt = new DataTable(); try { conn.Open(); System.Data.Odbc.OdbcCommand comm = new System.Data.Odbc.OdbcCommand(); comm.CommandText = @"SELECT * FROM " + @FileName; comm.Connection = conn; dt.Load(comm.ExecuteReader()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally{ conn.Close(); } return dt; } The Variable for the filename is "C:\\Users\\psun\\Desktop\\New folder\\plog.DBF" At run time I get this error ERROR [42000] [Microsoft][ODBC dBase Driver] Syntax error in FROM clause. at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader) at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Odbc.OdbcCommand.ExecuteReader() at UpLoad.Form1.loadExcel(String FileName) in c:\Users\psun\Documents\Visual Studio 2012\Projects\PLOGReader\PLOGReader\Form1.cs:line 60 c# odbc dbf share|improve this question edited Feb 5 '14 at 23:28 user3272686 187316 asked Feb 5 '14 at 23:23 Peter Sun 4211624 You can't use a parameter for the table name. –Andrew Morton Feb 5 '14 at 23:29 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted First, if you are working with Foxp