Using an ODBC DSN (Data Source Name) is a two step process.
1) You must first create the DSN via the "ODBC Data Source Administrator" program found in your computer's Control Panel (or Administrative Tools menu in Windows 2000). Make sure to create a SYSTEM DSN (not a USER DSN) when using ASP. You can also create the DSN via Visual Basic code.
2) Then use the following connection string - with your own DSN
name of course.
Imports System
Imports System.Data
Imports System.Data.Odbc
Module OdbcProvider
Sub Main()
' Set up connection string
Dim ConnString As String = "dsn=NorthwindOdbc"
' Set up query string
Dim CmdString As String = "SELECT * FROM employees"
'Declare Connection and DataReader variables
Dim Conn As OdbcConnection
Dim Reader As OdbcDataReader
Try
'Open Connection
Conn = New OdbcConnection(ConnString)
Conn.Open()
Aucun commentaire:
Enregistrer un commentaire