Unspecified error: E_FAIL(0x80004005)

  • Thread starter Thread starter bailey.matt
  • Start date Start date
B

bailey.matt

Hey,

While wandering about one day writing some VB code, I came across an
ugly little error, as seen above. Further delving into my code tosee
whether I am a complete and utter fool, I managed to track downthis
ugly little error's source, which is as follows:

aComm.CommandText = "SELECT Cust_No, Cust_Name " & _
"FROM Customers " & _
"WHERE LOWER(Cust_Name) LIKE " &
txtName.Text.ToLower() & _
" + '*' OR LOWER(Cust_City) LIKE " &
txtCity.Text.ToLower() & _
" + '*' OR LOWER(Cust_Prov) LIKE " &
txtProv.Text.ToLower & "+ '*'"

This little bad boy is causing the executeReader() method of the
command object to throw the aformentioned error. I am using an Access
database to run this query against, and putting the data collected into
a list box. I tried running the query without the WHERE clause from my
procedure, and it ran. The query runs in Access with the WHERE,
however, it won't run from here.

If anyone has an idea, that would be super duper.

Cheers,


Matt Bailey
 
Lower is using Access's VBA implementation and not Microsoft JET SQL, which
is what ADO and ADO.Net will use.

The equivalent string command for JET SQL would be LCASE

See the Access Table of Contents and scroll down to Microsoft Jet SQL
Reference.

Here are the other String commands, listed under ODB Scalar Functions

ASCII LENGTH RTRIM
CHAR LOCATE SPACE
CONCAT LTRIM SUBSTRING
LCASE RIGHT UCASE
LEFT
 
Back
Top