Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘syntax error in from clause’

BUG: Data Form Wizard Mishandles ‘-’ in Table or Field Names

Symptoms
When loading a form created by the Data Form Wizard, you may receive one ofthe following error messages:

Run-time error ‘-214217900 (80040e14)’, “Syntax error in FROM clause”
-or-

Run-time error ‘-214217904 (80040e10)’, “No value given for one or morerequired parameters”
Resolution
If the data source for a form created by the Data Form Wizard containsa dash ‘-’ in its name or in the name of a field, it is required that thedata source name or field name be delimited by brackets in a SQL statement.The Data Form Wizard does not include brackets around these names.

PRB: Executing Refresh Method of ADO Data Control Causes Syntax and Method Refresh Errors

Symptoms
When you set the RecordSource property of an ADO Data Control to a different SQL SELECT statement and then try to execute the Refresh method, the following error is returned:

Syntax error in FROM clause.which is followed by:

Run-time error ‘-2147217900(80040e14)’:
Method ‘Refresh’ of object ‘IAdodc’ failedor:

Method ‘Refresh’ of object ‘IAdodc’ failed when attempting to refresh an ADODC after setting the recordsource property to another value.The errors occur if the CommandType property of the ADO Data Control is set to adCmdTable.
Resolution
When the CommandType of the ADO Data Control is set to adCmdTable, “SELECT * From” is automatically prepended to the RecordSource value.
Setting the RecordSource to a table name results in a valid SQL statement, such as SELECT * FROM Tablename.
Setting the RecordSource to a SQL SELECT statement, such as Select * From Tablename, results in a SQL statement ofSelect * From Select * From Tablename, which is an invalid SQL statement.