Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created connection for SQL server management studio on form1 and i want to pass server name and database name to another form form2. After passing of server name and database name on form to i want to iterate database so that i can perform some operation on those tables presented in database.

What I have tried:

I am returning server name and database name from form1 page.

//my code on form1 for to return server name and database name.

public Server GetServer1()
        {
            return server1;
        }

        public string GetDatabase1()
        {
            return cboDatabase1.Text;
        }
Posted
Updated 20-Dec-17 1:33am

1 solution

Use SqlConnectionStringBuilder[^] to build a connection string using the server name and security details.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900