ODBC creation


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: ODBC creation

  1. #1
    Intern Guest

    ODBC creation


    Does anyone know how to create an ODBC connection through VB code. I need
    to do this for report generation.

    my goal is to have 5 ODBC connections create the first time a program runs,
    but I honestly have no clue where to begin.

    Thanks



  2. #2
    Joel Ryan Guest

    Re: ODBC creation

    Check out the API call SQLConfigDataSource.
    -- Joel

    Intern wrote:

    > Does anyone know how to create an ODBC connection through VB code. I need
    > to do this for report generation.
    >
    > my goal is to have 5 ODBC connections create the first time a program runs,
    > but I honestly have no clue where to begin.
    >
    > Thanks



  3. #3
    FaisalKhan Guest

    Re: ODBC creation


    Go to the Refrences in the Project on the VB Menu Editor,and include Microsoft
    Active Data Objects 2.1 Library,Now u can follow the code to create a connection
    dim cn as adodb.connection
    set cn=new adodb.connection
    cn.open "MyConnection"

    Well before opening the connection u have to create a driver for ur database,if
    u r using win2000 then goto control panel click on Administrative Tools,then
    click on datasources(odbc),in the System DSN tab ,click on new then select
    the tool u r using to create database,e.g Access ,then click on Finish,in
    the next screen enter "MyConnection" against Data Source Name and browse
    the database,now this is the name "MyConnection" u have to give while opening
    ur connection like
    cn.open "MyConnection"
    After opening the connection u can open recordsets like

    dim rs as adodb.recordset
    set rs=new adodb.recordset
    rs.open "RecordSetName",cn
    I hope now it will be clear




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center