Newbi 'how to' questions

C

Connie McBride

I am a long time Delphi programmer.
I am starting to work with c#.
I have a couple of questions on how to define connection settings on the
fly, since I have many client sites, each with their own database setup
differently as far as name, server name etc. Pretty common.

My Delphi App uses components to retrieve avaliable server names and
available database names, then I wrote code to build the connection string.
I am trying to find either a way to call up the standard connection dialog
box, or to get the server names/database names from c#.
There is an overwhelming amount of help, but everywhere I've looked, the
connection is hardcoded in some way, or the user has to type in the
servername/database name with no selection from combo boxes.

Does anyone have an example of how to dynamically create the connection
string, or how to get the servername/database lists so I can create the
string myself?
 
A

AlexS

If you have or can create lists of servers and databases you can fill list
or combo boxes using basic samples for these controls from MSDN.

You can create connection string using string operations like +, Append and
others.

What exactly is causing you grief?
 
C

Connie McBride

What exactly is causing you grief?
Getting the list of servers and databases. Is there a simple way of doing
that?
 
M

Mobile

I am a long time Delphi programmer.
I am starting to work with c#.
I have a couple of questions on how to define connection settings on the
fly, since I have many client sites, each with their own database setup
differently as far as name, server name etc. Pretty common.

My Delphi App uses components to retrieve avaliable server names and
available database names, then I wrote code to build the connection string.
I am trying to find either a way to call up the standard connection dialog
box, or to get the server names/database names from c#.
There is an overwhelming amount of help, but everywhere I've looked, the
connection is hardcoded in some way, or the user has to type in the
servername/database name with no selection from combo boxes.

Does anyone have an example of how to dynamically create the connection
string, or how to get the servername/database lists so I can create the
string myself?


you can drop a file on the desktop,rename to "1.udl".
double click it and edit.

finally,open the file with notepad,you'll see the connectionString
there.
 
B

Ben Voigt [C++ MVP]

Connie McBride said:
I am a long time Delphi programmer.
I am starting to work with c#.
I have a couple of questions on how to define connection settings on the
fly, since I have many client sites, each with their own database setup
differently as far as name, server name etc. Pretty common.

My Delphi App uses components to retrieve avaliable server names and
available database names, then I wrote code to build the connection
string.
I am trying to find either a way to call up the standard connection dialog
box, or to get the server names/database names from c#.
There is an overwhelming amount of help, but everywhere I've looked, the
connection is hardcoded in some way, or the user has to type in the
servername/database name with no selection from combo boxes.

Does anyone have an example of how to dynamically create the connection
string, or how to get the servername/database lists so I can create the
string myself?

Searching for "enumerate data sources" or "enumerate ODBC data sources" gets
a lot of information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top