View Full Version : connection string for database

03-18-2013, 09:51 AM
Hello, i am working on a asp.net website
I have vs 2010 and sql server 2008

I created a database via server explorer - selected sql client server and the default server name (my pc name was there to choose from the dropdown menu) and then windows authentication and a name of database (baza).

Now i have this under data connections: my database where i can create tables and so on.. i think its good till now

So my question is, how do i connect to this database now via c# ? The connection string ?

EDIT: Solved problem

03-29-2013, 01:52 PM
If you created Connection Manager in your project then you can simply call the connection string from there.
String connection = this.dts.connections["<connection_manager_name>"];
And use this connection :
using (var conn = new SqlConnection(connection))

04-04-2013, 03:23 PM
It is very simple to establish a database connection using C# language. The video link that I provided below will show how to create a database connection with easy steps.


04-06-2013, 11:08 AM
Take a look in to this article about few basic steps on database connection including connection string in asp.net