0 pts.
 VB Program error
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.

Software/Hardware used:
ASKED: September 17, 2004  3:26 AM
UPDATED: September 17, 2004  8:42 AM

Answer Wiki:
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
Last Wiki Answer Submitted:  September 17, 2004  5:05 am  by  JVerstraeten   0 pts.
All Answer Wiki Contributors:  JVerstraeten   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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 pts.