?
Solved

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

Posted on 2006-07-07
7
Medium Priority
?
2,506 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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

777 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