3

I would like to know what is different between SqlConnection and SqlConnectionStringBuilder

2 Answers 2

7

Apples and Oranges.

SqlConnection actually controls the connection to the database.

SqlConnectionStringBuilder helps to dynamically create the connection string used in the SqlConnection.

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection(v=vs.110).aspx

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder(v=vs.110).aspx

Sign up to request clarification or add additional context in comments.

Comments

7

SqlConnectionStringBuilder is simple a nifty utility to build/parse/modify a connection string. It's not esssential, and often it's entirely unnecessary.

SqlConnection is the actual database connection. You pass a connection string to it (doesn't matter if it came from a SqlConnectionStringBuilder or not) and you can talk to the database.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.