Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prompt for Database Connection String

I would like to offer a database connection prompt to the user. I can build my own, but it would be nice if I can use something that somebody else has already built (maybe something built into Windows or a free library available on the Internet). Anybody know how to do this in .Net?

EDIT: I found this and thought it was interesting: Showing a Connection String prompt in a WinForm application. This only works for SQL Server connections though.

like image 854
Brian Avatar asked Sep 09 '08 23:09

Brian


People also ask

How do I find my database connection string?

Right-click on your connection and select "Properties". You will get the Properties window for your connection. Find the "Connection String" property and select the "connection string". So now your connection string is in your hands; you can use it anywhere you want.

What is a connection string in database?

A connection string is a string that contains information about a data source (usually a database engine), as well as the information necessary to connect to it.

How do I check my database connection?

To test the connection to your database, run the telnet hostname port on your Looker server. For example, if you are running MySQL on the default port and your database name is mydb, the command would be telnet mydb 3306 . If the connection is working, you will see something similar to this: Trying 10.10.


2 Answers

You might want to try using SQL Server Management Objects. This MSDN article has a good sample for prompting and connecting to a SQL server.

like image 171
Gulzar Nazim Avatar answered Sep 20 '22 06:09

Gulzar Nazim


ADO.NET has the handy ConnectionStringBuilder which will construct and validate a connection string. This would at least take the grunt work out of one part, allowing you to create a simple dialog box for the input.

like image 24
FlySwat Avatar answered Sep 19 '22 06:09

FlySwat