Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with ADO Update using Like in WHERE clause

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
Hello All,

I am getting the following run time error when trying to use an ADO connection object Execute method.

Run-time error '-2147217900 (80040314)':

Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE',
'SELECT', or 'UPDATE'.

The initial reset SQL works with no problems:

UPDATE [TempTable] SET Included1 = True, Excluded1 = False

However, I get the above error with any of the following:

UPDATE [TempTable] _
SET Excluded1 = True WHERE [Name] LIKE "_j2a*"
UPDATE [TempTable] _
SET Excluded1 = True WHERE [Name] LIKE '_j2a*'
UPDATE [TempTable] _
SET Excluded1 = True WHERE [Name] LIKE "_j2a%"
UPDATE [TempTable] _
SET Excluded1 = True WHERE [Name] LIKE '_j2a%'

I also tried all of the above combinations with an Alias in case the sqare brackets [] around Name were the problem:

UPDATE [TempTable] AS Temp _
SET Temp.Excluded1 = True WHERE Temp.Name LIKE "_j2a*"

Any ideas or alternate suggestions out there? Thanks!


Have a great day!

j2consulting@yahoo.com
 
Have you tried something like this ?
strSQL = "UPDATE TempTable SET Excluded1 = True WHERE TempTable.Name LIKE '_j2a%'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top