Construct OdbcConnection get unhandle error in Windows 2000

galileo

New member
Joined
Jan 21, 2005
Messages
4
Programming Experience
Beginner
y develop computer is windows XP.
My program is just five lines. I am using visual basic .net 2003. I set
the start procedure to sub main. It works fine with my computer. But when I
run the program in windows 2000 and windows 98 system. It goes up an error

Application has generated an exception that could not be handle
Process id=0x300 (768), Thread id=0x410(1040)

Click OK to terminate the application
Click CANCEL to debug the application

The program is like that:
Module Module1
Dim a As New Odbc.OdbcConnection
Sub main()
End Sub
End Module


But if I just declare without contructing the odbcconnection, it work fine
Dim a As Odbc.OdbcConnection

But once I contruct it, it can't
a=new odbc.odbcconnection


This suitation is the same when I use Csharp, surely the error message is
different but still cannot guess the error.

I have install .net framework, mdac2.8 odbc_net but still cannot work
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Try adding the connection string.
Dim a As New Odbc.OdbcConnection("Your connection string")

TPM
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
The new constructor for the Odbc.OdbcConnection is overloaded, one procedure with no parameters and one with the connection string. It's very odd that an exception is thrown since the syntax seems correct (to me at least).
Whereas adding the connection string may do away with the error, it would still be interesting to know why the exception is thrown and what it is.

Have you tried clicking CANCEL to debug the application? If so, what is the true error message (enclose the constructor in a try/catch block to show the error message).

Another thing you may check into is to see whether the .NET runtime is installed on the 2000 & 98 systems.
 

galileo

New member
Joined
Jan 21, 2005
Messages
4
Programming Experience
Beginner
If i press cancel. the error message is like that
Registered JLT debugger is not available. An attempt to launch a JLT debugger with the following command result in an error code of 0x2 (@). Please check computer settings.

cordbg.exe !a 0x1d4

Click on Retry to have the process wait while attaching adebugger manually
Click on cancel to abort the JLT debug request.

I also try to catch the exception. and It cannot catch indeed. I try to delcare ex to exception or odbcexception. But the program still cannot display the last message "the program not terminated". That means the program shut down at that statement.

Anyone can help me? I got crazy....
Sub main()
Dim a As Odbc.OdbcConnection
Try
a = New Odbc.OdbcConnection
Catch ex As Exception
MsgBox(ex.Message)
End Try
MsgBox("the program not terminated")
End Sub
 
Top Bottom