Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Source Question

Status
Not open for further replies.

mlager

Programmer
Sep 1, 2006
74
US
I have a simple Visual Basic application that I've created (I'm a beginner) that essentially pulls data out of a SQL table and presents it in a table. Very simple. It was created in VS2008.

One of the things I'm trying to figure out is how am I able to give the user the ability to tell the application which server, database, and login credentials to use when pulling the data? Currently, I have it set to point to an ODBC driver, but I'd like to make it a little more integrated into the application.

Could anyone possibly help me?
 
Based upon user input, build your Connection String on the fly. At start up ask them which database, server, etc and plug those into your connection string.

Code:
Connection String Example:

Cnn.ConnectionString = "UId=[i]LoginName[/i];pwd=[i]Password[/i];Data Source=[i]ServerHostName or IP[/i];Initial Catalog=[i]DatabaseName[/i];"

--------------------------------------------------
Bluto: What? Over? Did you say "over"? Nothing is over until we decide it is! Was it over when the Germans bombed Pearl Harbor? No!
Otter: Germans?
Boon: Forget it, he's rolling.
--------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top