confused with connections in asp.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kkshansid
    New Member
    • Oct 2008
    • 232

    confused with connections in asp.net

    i m from asp background
    i m very new to asp.net
    n i m confused with connections in asp.net
    i have a project in asp.net for practice
    its web.config file which i think is a connection file has connection with sql express
    what should i do to connect it with sql server 2005
    Code:
     
    <?xml version="1.0"?>
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <appSettings/>
    <connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=localhost\SQLExpress;Initial Catalog=asd;Integrated Security=True" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <system.web>
    <compilation debug="true"/>
    <authentication mode="Windows"/>
     
     
    </system.web>
     
    </configuration>
  • Bassem
    Contributor
    • Dec 2008
    • 344

    #2
    Simple connectionStrin g
    <add name="dbConnect ionString" connectionStrin g="Data Source=.\SQLEXP RESS;AttachDbFi lename=|DataDir ectory|\dbName. mdf;Integrated Security=True;C onnect Timeout=30;User Instance=True"
    providerName="S ystem.Data.SqlC lient" />
    Now put your database in the data directroy.
    I hope it will help!
    Regards,
    Bassem
    Last edited by Bassem; Feb 1 '09, 08:10 PM. Reason: Add tags

    Comment

    • kkshansid
      New Member
      • Oct 2008
      • 232

      #3
      connect it with sql server 2000 or 2005

      but i hav to connect it with sql server 2000 or 2005 which hav username and password and server authentication mode.your connection is still with sql express

      Comment

      • kunal pawar
        Contributor
        • Oct 2007
        • 297

        #4
        See "Data Source" is your sever name. Like tt\SQLExpress or may be TT its depeands when you install Sql Server 2005.

        Or you can refer connectionstrin gs.com

        Comment

        • sangam56
          New Member
          • Nov 2007
          • 68

          #5
          Hi kkshansid,
          You can have the connectionstrin g in the web.config file like this:
          Code:
           
          <!-- Connection strings-->
          <connectionStrings>
          <remove name="MyConnectionString"></remove>
          <add name="MyConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyDB;User ID=mysqlusername;Password=mypassword;pooling=false" providerName="System.Data.SqlClient"/>
          </connectionStrings>
          Hope this helps.

          Comment

          • kkshansid
            New Member
            • Oct 2008
            • 232

            #6
            authentication mode

            what about authentication mode windows mode dont take user id and password

            Comment

            • sangam56
              New Member
              • Nov 2007
              • 68

              #7
              You can just use Integrated Security=true in the connection string if you are going to use Windows Authentication mode.

              Code:
               
              <!-- Connection strings-->
              <connectionStrings>
              <remove name="MyConnectionString"></remove>
              <add name="MyConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=true;pooling=false" providerName="System.Data.SqlClient"/>
              </connectionStrings>
              Waiting you feedback. Thanks.

              Comment

              • kkshansid
                New Member
                • Oct 2008
                • 232

                #8
                it is sql server 2005 not sql express

                sql server 2005 details
                server name=kkshansid
                user id=sa
                password=
                it is sql server 2005 not sql express
                what should be authentication mode?

                Comment

                • sangam56
                  New Member
                  • Nov 2007
                  • 68

                  #9
                  Now perhaps it is my turn to be confused! It seems you have some different requirement. I hope this link provides you much guidance.

                  Connection strings for SQL Server 2005. Connect using ODBC Driver 11 for SQL Server, Microsoft.Data.SqlClient, SqlConnection, SQLNCLI11 OLEDB.


                  Hope you find the right connection string here. Thank you.

                  Comment

                  Working...