?
Solved

Run-time error '-2147467259 (80004005)': Unspecified error

Posted on 2006-07-07
7
Medium Priority
?
2,530 Views
Last Modified: 2008-01-09
Hi all,
  I am using Vb6.0 with SQL Server 7.0.
The code is below
If rSetQuery.EOF Then
        If rSetQuery.State <> adStateClosed Then rSetQuery.Close
        mySql = "Select Top 50 * from FDHS WHERE CustomerName >'" & Trim(tdbtName) & "' Order By Customername,Trxdate"
        rSetQuery.Open mySql, Con
End If
When run this query in SQL Server Enterprise manager I can get the top 50 results.
When I run in the vb6.0 I am getting the error
Run-time error '-2147467259 (80004005)':
Unspecified error
The fieldname CustomerName is varchar 75. tdbtname is the textbox control in the VB.
Can anyone help me to solve this problem asap.
Thanks & Regards,
K.Siva.
0
Comment
Question by:siva2k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
7 Comments
 
LVL 35

Expert Comment

by:Raynard7
ID: 17057102
How is the con connected? it is not set in  your code - this is often a cause for errors;

also - is tdbtName escaped - ie could it contain a ' ? which would ruin the code.

If you get to the rSetQuery.Open mySql, Con line and break on it  - then copy the value for mySql, does this run in enterprise manager?

Also - where is the error occuring?
0
 

Author Comment

by:siva2k
ID: 17057574
Con is connected as per normal.
I have escaped tdbtName.
I run the mySQL is enterprise manager I can get the result.
I am getting the error at
rSetQuery.Open mySql, Con
0
 
LVL 29

Accepted Solution

by:
leonstryker earned 200 total points
ID: 17058529
Try this:

        If rSetQuery.State <> adStateClosed Then rSetQuery.Close

        mySql = "Select Top 50 * from FDHS WHERE CustomerName >'" & Trim(tdbtName) & "' Order By Customername,Trxdate"
        Debug.Print mySql

        rSetQuery.Open mySql, Con, adOpenStatic, adLockOptemistic

It is a good idea to print out the SQL into the Immediate window during debugging just to see what you are passing to the database.  

I think your problem is with this part CustomerName >'" & Trim(tdbtName) & "' .  I am pretty sure the driver does not like the > operator with a text datatype.

Leon
0
 
LVL 35

Assisted Solution

by:Raynard7
Raynard7 earned 200 total points
ID: 17077215
I agree about seeing the SQL;

The error number relates to unparseable SQL  -  I am wondering if you can post the result of mySql - so we can see what the issue is I agree with leon - I think that this value is the problem - tdbtName you say is escaped - are you using the mySql dll for that?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question