dynamic database connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lisav
    New Member
    • Jun 2007
    • 2

    #1

    dynamic database connection

    For one of my projects, i need to develop a product in .net which will be connecting to a company's database to run specific queries. The database is unknown at development time.

    1. Which component is able to let the user dynamically select a database connection and return a connection string such that i can save it? Or is there a better way to do this in .net code easily?

    2. Given that connection string, and a usergiven query for that database, for how can i run that query? Is there a generic datareader, executescalar, etc

    any help much appreciated!!!! !

    Lisa
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    One way may be to have each database connection and query in a class and call the class based the user selection?

    Comment

    • radcaesar
      Recognized Expert Contributor
      • Sep 2006
      • 759

      #3
      Fetch all the databases from the server using SP_DATABASES

      Populate that into a dropdown and let user to select the db.

      Connect to that DBName, Username and Password which u get from that user.

      Thats it :)

      Comment

      Working...