VB Program error

pts.
Tags:
Visual Basic
i have a problem with my vb program. I encountered a run time error: 'ODBC SQL driver timeout expired.' I executed an sql statement: " SELECT distinct(ref), mkg, vessel_name From posummview WHERE podate > DATEADD(day,-DAY(GETDATE()),DATEADD(month,-2,getdate())) and Not mkg is null AND mkg <> '' and officer ='" & frmLogin.logName & "'" the program must show the Purchase Order listing in a grid. i cant find way of getting rid of this. this error pops up and the grid doesnt show up. i hope you could email me if you have any idea. thnks.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi Abby,

When using a ODBC driver, you normally have 2 types of ODBC timeouts : a Connect Timeout and a General Timeout. The Connect Timeout is the time the driver waits to validate the connection wanted. If passed, your connection fails. The other one is the time delay the driver uses to check if the communication between the client and the server is still valid. If for example your network connection falls down, the general timeout will notice that and produce the error mentioned. It also can come from a less performant SQL Server server or network, so the answers to your query takes too long or the network is too slow. You can test this by running the query directly on the database server to see how long it takes to produce the query as such. If this goes fast, you can check your network by running the same query from an isql session from a client PC. If this is slow, you know it’s the network. If not, you know it has to do with your ODBC settings or the ADO data connection type you use. If you set the timeout to 0 – meaning that no timeout is specified – you’re VB program must work. If not, something else is wrong with your code. If ok, you can play with the timeout settings, 60 (1′) – 300 (5′) etc. to find the ideal setting for your apps. You can also optimise your connection method in VB for first record retrieval or not (fetch first 10 records, then the rest).
I hope this will help you in resolving your problem.

Regards,
Joris

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Mcp111
    If the query takes too long to execute directly on sql server then you should tune the query by checking indexes on podate, etc.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following