Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Automating Database connection

Automating Database connection

Scheduled Pinned Locked Moved Visual Basic
databasemysqlsql-serveroraclesysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ips_sun
    wrote on last edited by
    #1

    Hi experts! my query is.. can we create a dynamic conncation string at run time... no matter to which database we r connecting to.. it may be SQL server, Oracle, MYSQl, ACCESS... etc. when ever i execute my appplication... the user shud be able to choose from the available drivers.... to which database they want to make connection ... like a wizard. i am using VB 6.0. Or is it possible that ... the wizard which Microsoft provides for connection string...cud be called directly into the application.. from which connection shud be made automatically depending upon which database does the user has selected... is there any aPI to handle this!!! the reason.. i m askin this.. is to avoid the massive chunk of code to be written! which is surely gonna hang me up in the office for next couple of weeks! Any suggestions please...!! thanx in advance..!

    D 1 Reply Last reply
    0
    • I ips_sun

      Hi experts! my query is.. can we create a dynamic conncation string at run time... no matter to which database we r connecting to.. it may be SQL server, Oracle, MYSQl, ACCESS... etc. when ever i execute my appplication... the user shud be able to choose from the available drivers.... to which database they want to make connection ... like a wizard. i am using VB 6.0. Or is it possible that ... the wizard which Microsoft provides for connection string...cud be called directly into the application.. from which connection shud be made automatically depending upon which database does the user has selected... is there any aPI to handle this!!! the reason.. i m askin this.. is to avoid the massive chunk of code to be written! which is surely gonna hang me up in the office for next couple of weeks! Any suggestions please...!! thanx in advance..!

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      A connection string is nothing but a normal string of text. You need to have template strings for all the database engines you're going to support. You can find examples at http://www.connectionstrings.com[^]. After that, you'd have to write a data layer for each database engine you're supporting too. Access doesn't support the same SQL syntax that SQL Server does and Orcale has it's own flavor too. Each version of this data layer would implement an Interface that you write to provide all the functions you need. To support all this, you wouldnt be saving yourself frmo writing a "massive chunk" of code, you'd be guaranteeing it.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups