We help IT Professionals succeed at work.
Get Started

ODBC ConnectionTimeout not working?

EwS
EwS asked
on
340 Views
Last Modified: 2010-08-05
If the user name or password is invalid as I'm attempting to make a
connection, I get the login window. The problem with that is when my
application runs as a service, the user can't really enter that information,
so I just want to set up a timeout and when the error gets generated, I want
to close the login window. Here's my code, but the timeout never occurs, what
am I doing wrong?

Try
  Dim cnOdbc As OdbcConnection
  cnOdbc = New OdbcConnection(strConnectionString)
  cnOdbc.ConnectionTimeout = 600
  cnOdbc.Open()
Catch ex As Exception
  ' Here I want to close the login window by using cnOdbc.Close() or cnOdbc.Dispose()?
  ' Or if the timeout occurs, the window would be closed automatically?
End Try

I'm using VS 2005, I haven't found anything that would say the
ConnectionTimeout property is not supported.
Thank you!
Comment
Watch Question
Senior Software Deveolper/Architect
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE