ODBC

  • Thread starter Thread starter Yama
  • Start date Start date
Y

Yama

Hi,

Does anyone know how I could write a program that'll upon click the
executable create an ODBC connection on host machines?

Yama
 
Hi,

Does anyone know how I could write a program that'll upon click the
executable create an ODBC connection on host machines?

Yama

Sure,

Look at the System.Data.Odbc namespace.

In particular, start with:

Imports System.Data.Odbc

Dim cnDatabase As OdbcConnection
cnDatabase.ConnectionString = "<odbc connection string>
cnDatabase.Open()

.. use OdbcCommand, OdbcDataReader, OdbcDataAdapter, etc

cnDatabase.Close()


The MSDN docs have examples..

// CHRIS
 
Hi Chris,

I would actually like for the program to create a completely new ODBC DSN. I
remember in VB6 there was something called RegisterDatabase to accomplish
that but in VB.NET we do not have that. How can I dynamically create an ODBC
connection?

Yama
 
Hi Yama,

If you create it new, why not OleDB or SQL, ODBC has some disadvantages in
dotNet.

Cor
 
You could just use the Registry functions to write your
own DSN. Depending where you want them (Current
User/System/etc...) I think it is HKEY_LOCAL_MACHINE(or
whatever)\Software\ODBC\ODBC.INI. Create one via the
Control Panel to see what keys and values you need to set
it up.
 
Hello Cor,

This is a side project I would like to automate the deployment of ODBC to
any machine.
This is for a FoxPro application my company uses.

Yama
 
Back
Top