none
Connection string RRS feed

  • Question

  • Hi everyone,

     

    Im a newbie in development field. I'm trying to develop a windows based project.

    but i cant find the correct connection string for connecting with the database. can anyone please give me a sample connection string.

    im using sqlserver 2008 and front end asp.net with c#.

    thank you in advance.

    Saturday, June 26, 2010 4:38 AM

Answers

  • If the database is on the same machine as your app,

    Server=.;Database=dbname;Integrated Security=SSPI

    You can replace . with the hostname if not your local machine.

    The above assumes that the database server is set up to use Windows integrated security (the default).  If the database server has assigned you an SQL-specific user name and password, use the following:

    Server=.;Database=dbname;User Id=user;Password=password

    Saturday, June 26, 2010 2:19 PM
  • Depends upon a number of factors, such as whether you are using Windows integrated security or SQL Server security and, which .NET library you are using (ODBC? OLEDB? SQL native?). The following link has a number of examples:

    http://www.connectionstrings.com/sql-server-2008

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Monday, June 28, 2010 12:07 PM

All replies

  • If the database is on the same machine as your app,

    Server=.;Database=dbname;Integrated Security=SSPI

    You can replace . with the hostname if not your local machine.

    The above assumes that the database server is set up to use Windows integrated security (the default).  If the database server has assigned you an SQL-specific user name and password, use the following:

    Server=.;Database=dbname;User Id=user;Password=password

    Saturday, June 26, 2010 2:19 PM
  • Depends upon a number of factors, such as whether you are using Windows integrated security or SQL Server security and, which .NET library you are using (ODBC? OLEDB? SQL native?). The following link has a number of examples:

    http://www.connectionstrings.com/sql-server-2008

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Monday, June 28, 2010 12:07 PM