how to connect to default instance of SQL Server?
-
Hello gurus, I'd like to know how I can get connected to the default instance of SQL Server with user login? Where can I find a code snipet that shows how to do that with Windows authentication and SQL Server authentication? Best regards. Fred.
There is no spoon.
-
Hello gurus, I'd like to know how I can get connected to the default instance of SQL Server with user login? Where can I find a code snipet that shows how to do that with Windows authentication and SQL Server authentication? Best regards. Fred.
There is no spoon.
bouli wrote:
I'd like to know how I can get connected to the default instance of SQL Server with user login?
By just specifying the machine name, without any instance part. You can find lots of examples of connection strings for SQL Server here: http://www.connectionstrings.com/?carrier=sqlserver[^]
Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos
-
Hello gurus, I'd like to know how I can get connected to the default instance of SQL Server with user login? Where can I find a code snipet that shows how to do that with Windows authentication and SQL Server authentication? Best regards. Fred.
There is no spoon.
Also, if you just want some examples related to your local databases you could look at the connection string that is located in the properties dialog when you select a database server in the server viewer section of VS2005. Aaron
_____________________________________________________________________ Our developers never release code. Rather, it tends to escape, pillaging the countryside all around. The Enlightenment Project (paraphrased comment) Visit Me at GISDevCafe
-
Hello gurus, I'd like to know how I can get connected to the default instance of SQL Server with user login? Where can I find a code snipet that shows how to do that with Windows authentication and SQL Server authentication? Best regards. Fred.
There is no spoon.
This should get you started.
try { SqlConnection connection = new SqlConnection("server=localhost; database=yourdb; user=yourusername; password=yourpassword); connection.Open(); } catch (SQLExcepton SqlE) { //Do you exception handling here connection.Close(); }
Remember, you need to include the System.Data.Sql namespace for this