 |
| VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 23rd, 2009, 06:12 PM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 15
Thanks: 5
Thanked 0 Times in 0 Posts
|
|
SQL query with LIKE not working
Hi
I am getting the following Automation error message when ever I use the following SQL Query in my VB6 program
Select * from Win32_NTLogEvent where message like '%something%'
Run-time error '-2147217385 (80041017)':
Automation error
but it is working with Select * from Win32_NTLogEvent where message = "something"
Can anybody tell me why this is coming.
Do I need to use any Project Reference, if so which one?
Thanks in advance
Jack
|
|

March 23rd, 2009, 06:35 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
hi...
What kind of database are you querying??
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

March 23rd, 2009, 10:58 PM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 15
Thanks: 5
Thanked 0 Times in 0 Posts
|
|
SQL Server 2000
|
|

March 23rd, 2009, 11:04 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
Does the first query by itself works inside SQL 2000?? It's a weird error, looks like the query is wrong, but it seems to be correct.
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

March 24th, 2009, 12:19 AM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 15
Thanks: 5
Thanked 0 Times in 0 Posts
|
|
Hi gbianchi,
I did not tried inside the SQL Server because my query gets the event logs on the application server with the given criteria.
My program was written in vb6 which queires the event logs and display the results.
It is working fine if i am not using LIKe keyword in my query.
But when ever I use the query with LIKE it is giving me an Automation error.
Thanks
|
|

March 24th, 2009, 12:44 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
well, never see a problem like that. obviously is a problem with the LIKE, but I really don't know what to tell you. Unless you can try it inside SQL, I don't think I have anything for you.
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

March 24th, 2009, 02:49 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
Are the event logs *IN* the SQL Server DB?? Or are they in something like LDAP, external to the DB but accessible via a query, anyway??
I know that LDAP queries can't make use of the full range of SQL constructs that queries against an actual database can.
|
|

March 24th, 2009, 06:48 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
The name Win32_NTLogEvent seems to suggest you're executing WMI queries against Windows, rather than SQL Server.
Is that the case? Or is it just a coincidence?
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

March 24th, 2009, 05:13 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
Yeah, WMI...I couldn't remember the acronym. That's what I was referring to, also. Thanks, Imar!
Anyway, I would assume that WMI doesn't allow use of LIKE, so then it all makes sense.
|
|
The Following User Says Thank You to Old Pedant For This Useful Post:
|
|
|

March 24th, 2009, 05:22 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You're welcome.... And I also think you can't use a LIKE statement:
Quote:
|
Queries can use the WHERE clause for extension and customization, although it is not required. The WHERE clause is made up of a property or keyword, an operator, and a constant. All WHERE clauses must specify one of the predefined operators that are included in WQL. For more information about syntax, see WHERE Clause. For more information about valid WQL operators, see WQL Operators.
|
http://msdn.microsoft.com/en-us/library/aa392902.aspx
http://msdn.microsoft.com/en-us/libr...54(VS.85).aspx
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|
 |