≡ Menu

MyODBCDSN di vb.Net

‘General – Declaration

Imports System.Data.Odbc

‘ Code

Dim Conn As OdbcConnection
Dim ConnStr As String = “DSN=MyODBCNET”

Try
Conn = New OdbcConnection(ConnStr)
Conn.Open()
MsgBox(“Connected with ” + Conn.DataSource & _
Chr(10) + “Database ” + Conn.Database.ToString & _
Chr(10) + “Driver ” + Conn.Driver.ToString, _
MsgBoxStyle.Information, “Connected”)
Catch ODBCex As OdbcException
MsgBox(“ODBC Error : ” + ODBCex.Message)
Catch ex As Exception
MsgBox(“Error to connecting : ” + ex.Message)
Finally
Conn.Close()
Conn.Dispose()
End Try

{ 0 comments… add one }

Leave a Comment

CAPTCHA
*