Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2011
    Posts
    19
    Thanks
    6
    Thanked 0 Times in 0 Posts

    connection string for database

    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
    Last edited by bigbada; 03-18-2013 at 05:06 PM.

  • #2
    Regular Coder
    Join Date
    May 2012
    Location
    USA
    Posts
    102
    Thanks
    0
    Thanked 7 Times in 7 Posts
    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))

  • #3
    Regular Coder
    Join Date
    May 2012
    Location
    USA
    Posts
    102
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Regarding Connection String

    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.

    http://www.youtube.com/watch?v=P3FpM8f2suI

  • #4
    New Coder
    Join Date
    Jul 2012
    Location
    Bug Tracking, Isssue Tracking
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Take a look in to this article about few basic steps on database connection including connection string in asp.net

    http://www.w3schools.com/aspnet/aspnet_dbconnection.asp


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •