MSDE, ASP.NET, Visual Studio .NET, and connectionstrings

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan Sokalski

    #1

    MSDE, ASP.NET, Visual Studio .NET, and connectionstrings

    I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
    have created an empty database using Visual Studio .NET's Server Explorer.
    However, I am having trouble connecting to the database using ASP.NET. I
    think the problem is somewhere in my connection string, but because I do not
    know much about connection strings, I am not sure what it should look like.
    Can someone please help me determine what my connection string should look
    like? I am using the version of IIS that comes with XP Pro. Thanks.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。




  • Mike Epprecht \(SQL MVP\)

    #2
    Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

    All connection strings in one place. Find the syntax for your database connection using ADO.NET, ADO, ODBC, OLEDB, C#, VB, VB.NET, ASP.NET and more.


    --
    --------------------------------
    Mike Epprecht, Microsoft SQL Server MVP
    Zurich, Switzerland

    IM: mike@epprecht.n et

    MVP Program: http://www.microsoft.com/mvp

    Blog: http://www.msmvps.com/epprecht/

    "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
    news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...[color=blue]
    >I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
    > have created an empty database using Visual Studio .NET's Server Explorer.
    > However, I am having trouble connecting to the database using ASP.NET. I
    > think the problem is somewhere in my connection string, but because I do
    > not
    > know much about connection strings, I am not sure what it should look
    > like.
    > Can someone please help me determine what my connection string should look
    > like? I am using the version of IIS that comes with XP Pro. Thanks.
    > --
    > Nathan Sokalski
    > njsokalski@hotm ail.com
    > http://www.nathansokalski.com/
    >
    >
    >[/color]


    Comment

    • Juan T. Llibre

      #3
      Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs


      1. Create at least one empty table in that database,
      using the Server Explorer.

      2. Use the Server Explorer's "Add Connection" wizard
      ( right-click "Data Connections" ) to create a connection.

      3. The connection string will be created for you.

      4. Right-click the created connection and select Properties.

      5. Copy the connection string from the "Properties " box.




      Juan T. Llibre
      ASP.NET MVP

      Foros de ASP.NET en Español
      Ven, y hablemos de ASP.NET...
      =============== =======

      "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
      news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...[color=blue]
      >I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
      > have created an empty database using Visual Studio .NET's Server Explorer.
      > However, I am having trouble connecting to the database using ASP.NET. I
      > think the problem is somewhere in my connection string, but because I do not
      > know much about connection strings, I am not sure what it should look like.
      > Can someone please help me determine what my connection string should look
      > like? I am using the version of IIS that comes with XP Pro. Thanks.
      > --
      > Nathan Sokalski
      > njsokalski@hotm ail.com
      > http://www.nathansokalski.com/
      >
      >
      >[/color]


      Comment

      • Nathan Sokalski

        #4
        Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

        I have tried that, but the connectionstrin g that is created has plenty of
        stuff in it that gives me errors. For example:



        Server Error in '/PAPresenters' Application.
        --------------------------------------------------------------------------------

        Keyword not supported: 'provider'.
        Description: An unhandled exception occurred during the execution of the
        current web request. Please review the stack trace for more information
        about the error and where it originated in the code.

        Exception Details: System.Argument Exception: Keyword not supported:
        'provider'.

        Source Error:

        Line 28:
        Line 29: Private Sub btnExecute_Clic k(ByVal sender As System.Object,
        ByVal e As System.EventArg s) Handles btnExecute.Clic k
        Line 30: Dim myconnection As New
        System.Data.Sql Client.SqlConne ction("Provider =SQLOLEDB.1;Int egrated
        Security=SSPI;P ersist Security Info=False;Init ial Catalog=paprese nters;Data
        Source=NJS;Use Procedure for Prepare=1;Auto Translate=True; Packet
        Size=4096;Works tation ID=NJS;Use Encryption for Data=False;Tag with column
        collation when possible=False" )
        Line 31: Dim cmdTesting As New System.Data.Sql Client.SqlComma nd
        Line 32: Dim dataadapter As New System.Data.Sql Client.SqlDataA dapter

        Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 30

        Stack Trace:

        [ArgumentExcepti on: Keyword not supported: 'provider'.]
        System.Data.Com mon.DBConnectio nString.ParseIn ternal(Char[]
        connectionStrin g, UdlSupport checkForUdl, NameValuePair& keychain) +1133
        System.Data.Com mon.DBConnectio nString..ctor(S tring connectionStrin g,
        UdlSupport checkForUdl) +114
        System.Data.Sql Client.SqlConne ctionString..ct or(String connectionStrin g)
        +13
        System.Data.Sql Client.SqlConne ctionString.Par seString(String
        connectionStrin g) +96
        System.Data.Sql Client.SqlConne ction.set_Conne ctionString(Str ing value)
        +11
        System.Data.Sql Client.SqlConne ction..ctor(Str ing connectionStrin g) +158
        PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
        c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:30
        System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
        System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
        eventArgument) +57
        System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
        sourceControl, String eventArgument) +18
        System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
        System.Web.UI.P age.ProcessRequ estMain() +1292



        --------------------------------------------------------------------------------
        Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
        Version:1.1.432 2.2032



        Although I don't know much about connectionstrin gs, the little bit of
        experience I have leads me to think that the connectionstrin g generated by
        Visual Studio .NET has a lot more stuff in it than necessary, but either way
        it is not working. Why is this, and how can I fix it? Thanks.
        --
        Nathan Sokalski
        njsokalski@hotm ail.com
        有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


        "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
        news:e8E%23LaEe FHA.1136@TK2MSF TNGP12.phx.gbl. ..[color=blue]
        >
        > 1. Create at least one empty table in that database,
        > using the Server Explorer.
        >
        > 2. Use the Server Explorer's "Add Connection" wizard
        > ( right-click "Data Connections" ) to create a connection.
        >
        > 3. The connection string will be created for you.
        >
        > 4. Right-click the created connection and select Properties.
        >
        > 5. Copy the connection string from the "Properties " box.
        >
        >
        >
        >
        > Juan T. Llibre
        > ASP.NET MVP
        > http://asp.net.do/foros/
        > Foros de ASP.NET en Español
        > Ven, y hablemos de ASP.NET...
        > =============== =======
        >
        > "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
        > news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...[color=green]
        >>I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
        >> have created an empty database using Visual Studio .NET's Server
        >> Explorer.
        >> However, I am having trouble connecting to the database using ASP.NET. I
        >> think the problem is somewhere in my connection string, but because I do
        >> not
        >> know much about connection strings, I am not sure what it should look
        >> like.
        >> Can someone please help me determine what my connection string should
        >> look
        >> like? I am using the version of IIS that comes with XP Pro. Thanks.
        >> --
        >> Nathan Sokalski
        >> njsokalski@hotm ail.com
        >> http://www.nathansokalski.com/
        >>
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Juan T. Llibre

          #5
          Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

          It looks like you selected the wrong provider when creating the connection.

          You should select the ".NET Framework Data Provider for SQL Server"
          for a provider.

          Try it using that provider. You should get a correct string if you do.

          If you still have problems, try a simpler connection string :

          "Server=NJS;Int egrated Security=True;D atabase=paprese nters"

          That assumes that your MSDE's instance name is "NJS"
          and that your database name is "papresente rs".




          Juan T. Llibre
          ASP.NET MVP

          Foros de ASP.NET en Español
          Ven, y hablemos de ASP.NET...
          =============== =======

          "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
          news:esCnY4EeFH A.1404@TK2MSFTN GP09.phx.gbl...[color=blue]
          >I have tried that, but the connectionstrin g that is created has plenty of stuff in it
          >that gives me errors. For example:
          >
          >
          >
          > Server Error in '/PAPresenters' Application.
          > --------------------------------------------------------------------------------
          >
          > Keyword not supported: 'provider'.
          > Description: An unhandled exception occurred during the execution of the current web
          > request. Please review the stack trace for more information about the error and where it
          > originated in the code.
          >
          > Exception Details: System.Argument Exception: Keyword not supported: 'provider'.
          >
          > Source Error:
          >
          > Line 28:
          > Line 29: Private Sub btnExecute_Clic k(ByVal sender As System.Object, ByVal e As
          > System.EventArg s) Handles btnExecute.Clic k
          > Line 30: Dim myconnection As New
          > System.Data.Sql Client.SqlConne ction("Provider =SQLOLEDB.1;Int egrated
          > Security=SSPI;P ersist Security Info=False;Init ial Catalog=paprese nters;Data
          > Source=NJS;Use Procedure for Prepare=1;Auto Translate=True; Packet Size=4096;Works tation
          > ID=NJS;Use Encryption for Data=False;Tag with column collation when possible=False" )
          > Line 31: Dim cmdTesting As New System.Data.Sql Client.SqlComma nd
          > Line 32: Dim dataadapter As New System.Data.Sql Client.SqlDataA dapter
          >
          > Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 30
          >
          > Stack Trace:
          >
          > [ArgumentExcepti on: Keyword not supported: 'provider'.]
          > System.Data.Com mon.DBConnectio nString.ParseIn ternal(Char[] connectionStrin g,
          > UdlSupport checkForUdl, NameValuePair& keychain) +1133
          > System.Data.Com mon.DBConnectio nString..ctor(S tring connectionStrin g, UdlSupport
          > checkForUdl) +114
          > System.Data.Sql Client.SqlConne ctionString..ct or(String connectionStrin g) +13
          > System.Data.Sql Client.SqlConne ctionString.Par seString(String connectionStrin g) +96
          > System.Data.Sql Client.SqlConne ction.set_Conne ctionString(Str ing value) +11
          > System.Data.Sql Client.SqlConne ction..ctor(Str ing connectionStrin g) +158
          > PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
          > c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:30
          > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
          >
          > System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
          > eventArgument) +57
          > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String
          > eventArgument) +18
          > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
          > System.Web.UI.P age.ProcessRequ estMain() +1292
          >
          >
          >
          > --------------------------------------------------------------------------------
          > Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
          > Version:1.1.432 2.2032
          >
          >
          >
          > Although I don't know much about connectionstrin gs, the little bit of experience I have
          > leads me to think that the connectionstrin g generated by Visual Studio .NET has a lot
          > more stuff in it than necessary, but either way it is not working. Why is this, and how
          > can I fix it? Thanks.
          > --
          > Nathan Sokalski
          > njsokalski@hotm ail.com
          > http://www.nathansokalski.com/
          >
          > "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
          > news:e8E%23LaEe FHA.1136@TK2MSF TNGP12.phx.gbl. ..[color=green]
          >>
          >> 1. Create at least one empty table in that database,
          >> using the Server Explorer.
          >>
          >> 2. Use the Server Explorer's "Add Connection" wizard
          >> ( right-click "Data Connections" ) to create a connection.
          >>
          >> 3. The connection string will be created for you.
          >>
          >> 4. Right-click the created connection and select Properties.
          >>
          >> 5. Copy the connection string from the "Properties " box.
          >>
          >>
          >>
          >>
          >> Juan T. Llibre
          >> ASP.NET MVP
          >> http://asp.net.do/foros/
          >> Foros de ASP.NET en Español
          >> Ven, y hablemos de ASP.NET...
          >> =============== =======
          >>
          >> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
          >> news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...[color=darkred]
          >>>I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
          >>> have created an empty database using Visual Studio .NET's Server Explorer.
          >>> However, I am having trouble connecting to the database using ASP.NET. I
          >>> think the problem is somewhere in my connection string, but because I do not
          >>> know much about connection strings, I am not sure what it should look like.
          >>> Can someone please help me determine what my connection string should look
          >>> like? I am using the version of IIS that comes with XP Pro. Thanks.
          >>> --
          >>> Nathan Sokalski
          >>> njsokalski@hotm ail.com
          >>> http://www.nathansokalski.com/
          >>>
          >>>
          >>>[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • IIS Guru

            #6
            Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

            Hello Nathan,

            Try the following connection string

            "Driver={SQ L Server};Server= 127.0.0.1;Datab ase=<database>; Uid=sa;Pwd=;"en ter
            the name of the database, the user and the password in the appropriate
            places.This info will most likely go in your web.config. The following is a
            great site forconnection strings http://www.connectionstrings.com/-- IIS
            Guruhttp://www.iisassistan ce.com
            "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
            news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...[color=blue]
            >I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
            > have created an empty database using Visual Studio .NET's Server Explorer.
            > However, I am having trouble connecting to the database using ASP.NET. I
            > think the problem is somewhere in my connection string, but because I do
            > not
            > know much about connection strings, I am not sure what it should look
            > like.
            > Can someone please help me determine what my connection string should look
            > like? I am using the version of IIS that comes with XP Pro. Thanks.
            > --
            > Nathan Sokalski
            > njsokalski@hotm ail.com
            > http://www.nathansokalski.com/
            >
            >
            >[/color]


            Comment

            • Nathan Sokalski

              #7
              Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

              I think I am now passed the problem of the connectionstrin g, but am
              recieving a login failed error, as follows:

              Server Error in '/PAPresenters' Application.
              --------------------------------------------------------------------------------

              Login failed for user 'NJS\ASPNET'.
              Description: An unhandled exception occurred during the execution of the
              current web request. Please review the stack trace for more information
              about the error and where it originated in the code.

              Exception Details: System.Data.Sql Client.SqlExcep tion: Login failed for user
              'NJS\ASPNET'.

              Source Error:

              Line 33: cmdTesting.Comm andText = txtSQLStatement .Text
              Line 34: cmdTesting.Conn ection = myconnection
              Line 35: myconnection.Op en()
              Line 36: cmdTesting.Exec uteNonQuery()
              Line 37: myconnection.Cl ose()

              Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 35

              Stack Trace:

              [SqlException: Login failed for user 'NJS\ASPNET'.]
              System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
              isInTransaction ) +474
              System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
              options, Boolean& isInTransaction ) +372
              System.Data.Sql Client.SqlConne ction.Open() +384
              PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
              c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:35
              System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
              System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
              eventArgument) +57
              System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
              sourceControl, String eventArgument) +18
              System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
              System.Web.UI.P age.ProcessRequ estMain() +1292



              --------------------------------------------------------------------------------
              Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
              Version:1.1.432 2.2032


              I create my connection as follows:
              Dim myconnection As New System.Data.Sql Client.SqlConne ction("Data
              Source=NJS;Init ial Catalog=paprese nters;Integrate d Security=SSPI;" )



              I did not create a username or password when I created the database. I know
              what the user ASPNET is, so do I just need to include that somewhere in the
              connectionstrin g? If I do, do I need to include a password along with it? If
              so, what would this password be (my windows password?)? Thanks again.
              --
              Nathan Sokalski
              njsokalski@hotm ail.com
              有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


              "Mike Epprecht (SQL MVP)" <mike@epprecht. net> wrote in message
              news:uGxpiZEeFH A.1044@TK2MSFTN GP10.phx.gbl...[color=blue]
              > http://www.connectionstrings.com/
              >
              > --
              > --------------------------------
              > Mike Epprecht, Microsoft SQL Server MVP
              > Zurich, Switzerland
              >
              > IM: mike@epprecht.n et
              >
              > MVP Program: http://www.microsoft.com/mvp
              >
              > Blog: http://www.msmvps.com/epprecht/
              >
              > "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
              > news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...[color=green]
              >>I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
              >> have created an empty database using Visual Studio .NET's Server
              >> Explorer.
              >> However, I am having trouble connecting to the database using ASP.NET. I
              >> think the problem is somewhere in my connection string, but because I do
              >> not
              >> know much about connection strings, I am not sure what it should look
              >> like.
              >> Can someone please help me determine what my connection string should
              >> look
              >> like? I am using the version of IIS that comes with XP Pro. Thanks.
              >> --
              >> Nathan Sokalski
              >> njsokalski@hotm ail.com
              >> http://www.nathansokalski.com/
              >>
              >>
              >>[/color]
              >
              >[/color]


              Comment

              • Juan T. Llibre

                #8
                Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

                I think I tried it under .NET Beta 2, instead of .NET 1.1.
                Nevertheless, try the simpler connection string I suggested.

                Per
                http://msdn.microsoft.com/library/de...2000webapp.asp
                a slightly more optimized connection string is :

                "Server=localho st;Database=Pic s2Share;Trusted _Connection=Tru e;
                Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"

                But the simpler connection string I suggested
                should give you basic connectivity :

                "Server=NJS;Int egrated Security=True;D atabase=paprese nters"

                The optimized connection string for your case would be :

                "Server=NJS;Dat abase=papresent ers;Trusted_Con nection=True;
                Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"

                You could also use
                "Server=(local) ;Database=papre senters;Trusted _Connection=Tru e;
                Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"

                Using Trusted_Connect ion should prevent the error you're getting:
                Login failed for user 'NJS\ASPNET'.



                Juan T. Llibre
                ASP.NET MVP

                Foros de ASP.NET en Español
                Ven, y hablemos de ASP.NET...
                =============== =======

                "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                news:Oi55kZFeFH A.2844@TK2MSFTN GP14.phx.gbl...
                That is not one of the listed providers. the listed providers that are brought up are:

                If there is somewhere on the web that I can download the provider you mentioned from, I
                would like to know about it, but right now all I have are the ones shown above. Thanks.
                --
                Nathan Sokalski
                njsokalski@hotm ail.com
                有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


                "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                news:exM$pAFeFH A.1328@TK2MSFTN GP12.phx.gbl...[color=blue]
                > It looks like you selected the wrong provider when creating the connection.
                >
                > You should select the ".NET Framework Data Provider for SQL Server"
                > for a provider.
                >
                > Try it using that provider. You should get a correct string if you do.
                >
                > If you still have problems, try a simpler connection string :
                >
                > "Server=NJS;Int egrated Security=True;D atabase=paprese nters"
                >
                > That assumes that your MSDE's instance name is "NJS"
                > and that your database name is "papresente rs".
                >
                >
                >
                >
                > Juan T. Llibre
                > ASP.NET MVP
                > http://asp.net.do/foros/
                > Foros de ASP.NET en Español
                > Ven, y hablemos de ASP.NET...
                > =============== =======
                >
                > "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                > news:esCnY4EeFH A.1404@TK2MSFTN GP09.phx.gbl...[color=green]
                >>I have tried that, but the connectionstrin g that is created has plenty of stuff in it
                >>that gives me errors. For example:
                >>
                >>
                >>
                >> Server Error in '/PAPresenters' Application.
                >> --------------------------------------------------------------------------------
                >>
                >> Keyword not supported: 'provider'.
                >> Description: An unhandled exception occurred during the execution of the current web
                >> request. Please review the stack trace for more information about the error and where
                >> it
                >> originated in the code.
                >>
                >> Exception Details: System.Argument Exception: Keyword not supported: 'provider'.
                >>
                >> Source Error:
                >>
                >> Line 28:
                >> Line 29: Private Sub btnExecute_Clic k(ByVal sender As System.Object, ByVal e As
                >> System.EventArg s) Handles btnExecute.Clic k
                >> Line 30: Dim myconnection As New
                >> System.Data.Sql Client.SqlConne ction("Provider =SQLOLEDB.1;Int egrated
                >> Security=SSPI;P ersist Security Info=False;Init ial Catalog=paprese nters;Data
                >> Source=NJS;Use Procedure for Prepare=1;Auto Translate=True; Packet Size=4096;Works tation
                >> ID=NJS;Use Encryption for Data=False;Tag with column collation when possible=False" )
                >> Line 31: Dim cmdTesting As New System.Data.Sql Client.SqlComma nd
                >> Line 32: Dim dataadapter As New System.Data.Sql Client.SqlDataA dapter
                >>
                >> Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 30
                >>
                >> Stack Trace:
                >>
                >> [ArgumentExcepti on: Keyword not supported: 'provider'.]
                >> System.Data.Com mon.DBConnectio nString.ParseIn ternal(Char[] connectionStrin g,
                >> UdlSupport checkForUdl, NameValuePair& keychain) +1133
                >> System.Data.Com mon.DBConnectio nString..ctor(S tring connectionStrin g, UdlSupport
                >> checkForUdl) +114
                >> System.Data.Sql Client.SqlConne ctionString..ct or(String connectionStrin g) +13
                >> System.Data.Sql Client.SqlConne ctionString.Par seString(String connectionStrin g) +96
                >> System.Data.Sql Client.SqlConne ction.set_Conne ctionString(Str ing value) +11
                >> System.Data.Sql Client.SqlConne ction..ctor(Str ing connectionStrin g) +158
                >> PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                >> c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:30
                >> System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
                >>
                >> System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
                >> eventArgument) +57
                >> System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String
                >> eventArgument) +18
                >> System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
                >> System.Web.UI.P age.ProcessRequ estMain() +1292
                >>
                >>
                >>
                >> --------------------------------------------------------------------------------
                >> Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
                >> Version:1.1.432 2.2032
                >>
                >>
                >>
                >> Although I don't know much about connectionstrin gs, the little bit of experience I have
                >> leads me to think that the connectionstrin g generated by Visual Studio .NET has a lot
                >> more stuff in it than necessary, but either way it is not working. Why is this, and how
                >> can I fix it? Thanks.
                >> --
                >> Nathan Sokalski
                >> njsokalski@hotm ail.com
                >> http://www.nathansokalski.com/
                >>
                >> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                >> news:e8E%23LaEe FHA.1136@TK2MSF TNGP12.phx.gbl. ..[color=darkred]
                >>>
                >>> 1. Create at least one empty table in that database,
                >>> using the Server Explorer.
                >>>
                >>> 2. Use the Server Explorer's "Add Connection" wizard
                >>> ( right-click "Data Connections" ) to create a connection.
                >>>
                >>> 3. The connection string will be created for you.
                >>>
                >>> 4. Right-click the created connection and select Properties.
                >>>
                >>> 5. Copy the connection string from the "Properties " box.
                >>>
                >>>
                >>>
                >>>
                >>> Juan T. Llibre
                >>> ASP.NET MVP
                >>> http://asp.net.do/foros/
                >>> Foros de ASP.NET en Español
                >>> Ven, y hablemos de ASP.NET...
                >>> =============== =======
                >>>
                >>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                >>> news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...
                >>>>I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
                >>>> have created an empty database using Visual Studio .NET's Server Explorer.
                >>>> However, I am having trouble connecting to the database using ASP.NET. I
                >>>> think the problem is somewhere in my connection string, but because I do not
                >>>> know much about connection strings, I am not sure what it should look like.
                >>>> Can someone please help me determine what my connection string should look
                >>>> like? I am using the version of IIS that comes with XP Pro. Thanks.
                >>>> --
                >>>> Nathan Sokalski
                >>>> njsokalski@hotm ail.com
                >>>> http://www.nathansokalski.com/
                >>>>
                >>>>
                >>>>
                >>>
                >>>[/color]
                >>
                >>[/color]
                >
                >[/color]


                Comment

                • Nathan Sokalski

                  #9
                  Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

                  I eventually got past the Login Failed error by adding permissions for
                  NJS\ASPNET to the database file. However, I am now recieving the following
                  error:


                  Server Error in '/PAPresenters' Application.
                  --------------------------------------------------------------------------------

                  SQL Server does not exist or access denied.
                  Description: An unhandled exception occurred during the execution of the
                  current web request. Please review the stack trace for more information
                  about the error and where it originated in the code.

                  Exception Details: System.Data.Sql Client.SqlExcep tion: SQL Server does not
                  exist or access denied.

                  Source Error:

                  Line 33: cmdTesting.Comm andText = txtSQLStatement .Text
                  Line 34: cmdTesting.Conn ection = myconnection
                  Line 35: myconnection.Op en()
                  Line 36: cmdTesting.Exec uteNonQuery()
                  Line 37: myconnection.Cl ose()

                  Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 35

                  Stack Trace:

                  [SqlException: SQL Server does not exist or access denied.]
                  System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
                  isInTransaction ) +474
                  System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
                  options, Boolean& isInTransaction ) +372
                  System.Data.Sql Client.SqlConne ction.Open() +384
                  PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                  c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:35
                  System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
                  System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
                  eventArgument) +57
                  System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
                  sourceControl, String eventArgument) +18
                  System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
                  System.Web.UI.P age.ProcessRequ estMain() +1292



                  --------------------------------------------------------------------------------
                  Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
                  Version:1.1.432 2.2032


                  I have SQL Server Desktop Engine running (when I hover my cursor over the
                  icon in the system tray it says "Running - \\NJS - MSSQLSERVER" and the icon
                  shows the green arrow, which means it is running). What am I not doing?
                  Thank you very much for your help, I greatly appreciate the quick responses.
                  --
                  Nathan Sokalski
                  njsokalski@hotm ail.com
                  有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


                  "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                  news:%23XkXgEGe FHA.1400@TK2MSF TNGP15.phx.gbl. ..[color=blue]
                  >I think I tried it under .NET Beta 2, instead of .NET 1.1.
                  > Nevertheless, try the simpler connection string I suggested.
                  >
                  > Per
                  > http://msdn.microsoft.com/library/de...2000webapp.asp
                  > a slightly more optimized connection string is :
                  >
                  > "Server=localho st;Database=Pic s2Share;Trusted _Connection=Tru e;
                  > Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                  >
                  > But the simpler connection string I suggested
                  > should give you basic connectivity :
                  >
                  > "Server=NJS;Int egrated Security=True;D atabase=paprese nters"
                  >
                  > The optimized connection string for your case would be :
                  >
                  > "Server=NJS;Dat abase=papresent ers;Trusted_Con nection=True;
                  > Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                  >
                  > You could also use
                  > "Server=(local) ;Database=papre senters;Trusted _Connection=Tru e;
                  > Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                  >
                  > Using Trusted_Connect ion should prevent the error you're getting:
                  > Login failed for user 'NJS\ASPNET'.
                  >
                  >
                  >
                  > Juan T. Llibre
                  > ASP.NET MVP
                  > http://asp.net.do/foros/
                  > Foros de ASP.NET en Español
                  > Ven, y hablemos de ASP.NET...
                  > =============== =======
                  >
                  > "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                  > news:Oi55kZFeFH A.2844@TK2MSFTN GP14.phx.gbl...
                  > That is not one of the listed providers. the listed providers that are
                  > brought up are:
                  >
                  > If there is somewhere on the web that I can download the provider you
                  > mentioned from, I would like to know about it, but right now all I have
                  > are the ones shown above. Thanks.
                  > --
                  > Nathan Sokalski
                  > njsokalski@hotm ail.com
                  > http://www.nathansokalski.com/
                  >
                  > "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                  > news:exM$pAFeFH A.1328@TK2MSFTN GP12.phx.gbl...[color=green]
                  >> It looks like you selected the wrong provider when creating the
                  >> connection.
                  >>
                  >> You should select the ".NET Framework Data Provider for SQL Server"
                  >> for a provider.
                  >>
                  >> Try it using that provider. You should get a correct string if you do.
                  >>
                  >> If you still have problems, try a simpler connection string :
                  >>
                  >> "Server=NJS;Int egrated Security=True;D atabase=paprese nters"
                  >>
                  >> That assumes that your MSDE's instance name is "NJS"
                  >> and that your database name is "papresente rs".
                  >>
                  >>
                  >>
                  >>
                  >> Juan T. Llibre
                  >> ASP.NET MVP
                  >> http://asp.net.do/foros/
                  >> Foros de ASP.NET en Español
                  >> Ven, y hablemos de ASP.NET...
                  >> =============== =======
                  >>
                  >> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                  >> news:esCnY4EeFH A.1404@TK2MSFTN GP09.phx.gbl...[color=darkred]
                  >>>I have tried that, but the connectionstrin g that is created has plenty of
                  >>>stuff in it
                  >>>that gives me errors. For example:
                  >>>
                  >>>
                  >>>
                  >>> Server Error in '/PAPresenters' Application.
                  >>> --------------------------------------------------------------------------------
                  >>>
                  >>> Keyword not supported: 'provider'.
                  >>> Description: An unhandled exception occurred during the execution of the
                  >>> current web
                  >>> request. Please review the stack trace for more information about the
                  >>> error and where it
                  >>> originated in the code.
                  >>>
                  >>> Exception Details: System.Argument Exception: Keyword not supported:
                  >>> 'provider'.
                  >>>
                  >>> Source Error:
                  >>>
                  >>> Line 28:
                  >>> Line 29: Private Sub btnExecute_Clic k(ByVal sender As System.Object,
                  >>> ByVal e As
                  >>> System.EventArg s) Handles btnExecute.Clic k
                  >>> Line 30: Dim myconnection As New
                  >>> System.Data.Sql Client.SqlConne ction("Provider =SQLOLEDB.1;Int egrated
                  >>> Security=SSPI;P ersist Security Info=False;Init ial
                  >>> Catalog=paprese nters;Data
                  >>> Source=NJS;Use Procedure for Prepare=1;Auto Translate=True; Packet
                  >>> Size=4096;Works tation
                  >>> ID=NJS;Use Encryption for Data=False;Tag with column collation when
                  >>> possible=False" )
                  >>> Line 31: Dim cmdTesting As New System.Data.Sql Client.SqlComma nd
                  >>> Line 32: Dim dataadapter As New
                  >>> System.Data.Sql Client.SqlDataA dapter
                  >>>
                  >>> Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 30
                  >>>
                  >>> Stack Trace:
                  >>>
                  >>> [ArgumentExcepti on: Keyword not supported: 'provider'.]
                  >>> System.Data.Com mon.DBConnectio nString.ParseIn ternal(Char[]
                  >>> connectionStrin g,
                  >>> UdlSupport checkForUdl, NameValuePair& keychain) +1133
                  >>> System.Data.Com mon.DBConnectio nString..ctor(S tring connectionStrin g,
                  >>> UdlSupport
                  >>> checkForUdl) +114
                  >>> System.Data.Sql Client.SqlConne ctionString..ct or(String
                  >>> connectionStrin g) +13
                  >>> System.Data.Sql Client.SqlConne ctionString.Par seString(String
                  >>> connectionStrin g) +96
                  >>> System.Data.Sql Client.SqlConne ction.set_Conne ctionString(Str ing value)
                  >>> +11
                  >>> System.Data.Sql Client.SqlConne ction..ctor(Str ing connectionStrin g)
                  >>> +158
                  >>> PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                  >>> c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:30
                  >>> System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
                  >>>
                  >>> System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
                  >>> eventArgument) +57
                  >>> System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
                  >>> sourceControl, String
                  >>> eventArgument) +18
                  >>> System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
                  >>> +33
                  >>> System.Web.UI.P age.ProcessRequ estMain() +1292
                  >>>
                  >>>
                  >>>
                  >>> --------------------------------------------------------------------------------
                  >>> Version Information: Microsoft .NET Framework Version:1.1.432 2.2032;
                  >>> ASP.NET
                  >>> Version:1.1.432 2.2032
                  >>>
                  >>>
                  >>>
                  >>> Although I don't know much about connectionstrin gs, the little bit of
                  >>> experience I have
                  >>> leads me to think that the connectionstrin g generated by Visual Studio
                  >>> .NET has a lot
                  >>> more stuff in it than necessary, but either way it is not working. Why
                  >>> is this, and how
                  >>> can I fix it? Thanks.
                  >>> --
                  >>> Nathan Sokalski
                  >>> njsokalski@hotm ail.com
                  >>> http://www.nathansokalski.com/
                  >>>
                  >>> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                  >>> news:e8E%23LaEe FHA.1136@TK2MSF TNGP12.phx.gbl. ..
                  >>>>
                  >>>> 1. Create at least one empty table in that database,
                  >>>> using the Server Explorer.
                  >>>>
                  >>>> 2. Use the Server Explorer's "Add Connection" wizard
                  >>>> ( right-click "Data Connections" ) to create a connection.
                  >>>>
                  >>>> 3. The connection string will be created for you.
                  >>>>
                  >>>> 4. Right-click the created connection and select Properties.
                  >>>>
                  >>>> 5. Copy the connection string from the "Properties " box.
                  >>>>
                  >>>>
                  >>>>
                  >>>>
                  >>>> Juan T. Llibre
                  >>>> ASP.NET MVP
                  >>>> http://asp.net.do/foros/
                  >>>> Foros de ASP.NET en Español
                  >>>> Ven, y hablemos de ASP.NET...
                  >>>> =============== =======
                  >>>>
                  >>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                  >>>> news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...
                  >>>>>I have Visual Studio .NET and SQL Server Desktop Engine on my computer.
                  >>>>>I
                  >>>>> have created an empty database using Visual Studio .NET's Server
                  >>>>> Explorer.
                  >>>>> However, I am having trouble connecting to the database using ASP.NET.
                  >>>>> I
                  >>>>> think the problem is somewhere in my connection string, but because I
                  >>>>> do not
                  >>>>> know much about connection strings, I am not sure what it should look
                  >>>>> like.
                  >>>>> Can someone please help me determine what my connection string should
                  >>>>> look
                  >>>>> like? I am using the version of IIS that comes with XP Pro. Thanks.
                  >>>>> --
                  >>>>> Nathan Sokalski
                  >>>>> njsokalski@hotm ail.com
                  >>>>> http://www.nathansokalski.com/
                  >>>>>
                  >>>>>
                  >>>>>
                  >>>>
                  >>>>
                  >>>
                  >>>[/color]
                  >>
                  >>[/color]
                  >
                  >[/color]


                  Comment

                  • Juan T. Llibre

                    #10
                    Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

                    Did you try the connection strings I suggested,
                    or are you still using the other connection strings ?



                    Juan T. Llibre
                    ASP.NET MVP

                    Foros de ASP.NET en Español
                    Ven, y hablemos de ASP.NET...
                    =============== =======

                    "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                    news:esNBVAHeFH A.1920@tk2msftn gp13.phx.gbl...[color=blue]
                    >I eventually got past the Login Failed error by adding permissions for NJS\ASPNET to the
                    >database file. However, I am now recieving the following error:
                    >
                    >
                    > Server Error in '/PAPresenters' Application.
                    > --------------------------------------------------------------------------------
                    >
                    > SQL Server does not exist or access denied.
                    > Description: An unhandled exception occurred during the execution of the current web
                    > request. Please review the stack trace for more information about the error and where it
                    > originated in the code.
                    >
                    > Exception Details: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
                    > access denied.
                    >
                    > Source Error:
                    >
                    > Line 33: cmdTesting.Comm andText = txtSQLStatement .Text
                    > Line 34: cmdTesting.Conn ection = myconnection
                    > Line 35: myconnection.Op en()
                    > Line 36: cmdTesting.Exec uteNonQuery()
                    > Line 37: myconnection.Cl ose()
                    >
                    > Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 35
                    >
                    > Stack Trace:
                    >
                    > [SqlException: SQL Server does not exist or access denied.]
                    > System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean& isInTransaction ) +474
                    > System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
                    > options, Boolean& isInTransaction ) +372
                    > System.Data.Sql Client.SqlConne ction.Open() +384
                    > PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                    > c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:35
                    > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
                    >
                    > System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
                    > eventArgument) +57
                    > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String
                    > eventArgument) +18
                    > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
                    > System.Web.UI.P age.ProcessRequ estMain() +1292
                    >
                    >
                    >
                    > --------------------------------------------------------------------------------
                    > Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
                    > Version:1.1.432 2.2032
                    >
                    >
                    > I have SQL Server Desktop Engine running (when I hover my cursor over the icon in the
                    > system tray it says "Running - \\NJS - MSSQLSERVER" and the icon shows the green arrow,
                    > which means it is running). What am I not doing? Thank you very much for your help, I
                    > greatly appreciate the quick responses.
                    > --
                    > Nathan Sokalski
                    > njsokalski@hotm ail.com
                    > http://www.nathansokalski.com/
                    >
                    > "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                    > news:%23XkXgEGe FHA.1400@TK2MSF TNGP15.phx.gbl. ..[color=green]
                    >>I think I tried it under .NET Beta 2, instead of .NET 1.1.
                    >> Nevertheless, try the simpler connection string I suggested.
                    >>
                    >> Per
                    >> http://msdn.microsoft.com/library/de...2000webapp.asp
                    >> a slightly more optimized connection string is :
                    >>
                    >> "Server=localho st;Database=Pic s2Share;Trusted _Connection=Tru e;
                    >> Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                    >>
                    >> But the simpler connection string I suggested
                    >> should give you basic connectivity :
                    >>
                    >> "Server=NJS;Int egrated Security=True;D atabase=paprese nters"
                    >>
                    >> The optimized connection string for your case would be :
                    >>
                    >> "Server=NJS;Dat abase=papresent ers;Trusted_Con nection=True;
                    >> Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                    >>
                    >> You could also use
                    >> "Server=(local) ;Database=papre senters;Trusted _Connection=Tru e;
                    >> Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                    >>
                    >> Using Trusted_Connect ion should prevent the error you're getting:
                    >> Login failed for user 'NJS\ASPNET'.
                    >>
                    >>
                    >>
                    >> Juan T. Llibre
                    >> ASP.NET MVP
                    >> http://asp.net.do/foros/
                    >> Foros de ASP.NET en Español
                    >> Ven, y hablemos de ASP.NET...
                    >> =============== =======
                    >>
                    >> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                    >> news:Oi55kZFeFH A.2844@TK2MSFTN GP14.phx.gbl...
                    >> That is not one of the listed providers. the listed providers that are brought up are:
                    >>
                    >> If there is somewhere on the web that I can download the provider you mentioned from, I
                    >> would like to know about it, but right now all I have are the ones shown above. Thanks.
                    >> --
                    >> Nathan Sokalski
                    >> njsokalski@hotm ail.com
                    >> http://www.nathansokalski.com/
                    >>
                    >> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                    >> news:exM$pAFeFH A.1328@TK2MSFTN GP12.phx.gbl...[color=darkred]
                    >>> It looks like you selected the wrong provider when creating the connection.
                    >>>
                    >>> You should select the ".NET Framework Data Provider for SQL Server"
                    >>> for a provider.
                    >>>
                    >>> Try it using that provider. You should get a correct string if you do.
                    >>>
                    >>> If you still have problems, try a simpler connection string :
                    >>>
                    >>> "Server=NJS;Int egrated Security=True;D atabase=paprese nters"
                    >>>
                    >>> That assumes that your MSDE's instance name is "NJS"
                    >>> and that your database name is "papresente rs".
                    >>>
                    >>>
                    >>>
                    >>>
                    >>> Juan T. Llibre
                    >>> ASP.NET MVP
                    >>> http://asp.net.do/foros/
                    >>> Foros de ASP.NET en Español
                    >>> Ven, y hablemos de ASP.NET...
                    >>> =============== =======
                    >>>
                    >>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                    >>> news:esCnY4EeFH A.1404@TK2MSFTN GP09.phx.gbl...
                    >>>>I have tried that, but the connectionstrin g that is created has plenty of stuff in it
                    >>>>that gives me errors. For example:
                    >>>>
                    >>>>
                    >>>>
                    >>>> Server Error in '/PAPresenters' Application.
                    >>>> --------------------------------------------------------------------------------
                    >>>>
                    >>>> Keyword not supported: 'provider'.
                    >>>> Description: An unhandled exception occurred during the execution of the current web
                    >>>> request. Please review the stack trace for more information about the error and where
                    >>>> it
                    >>>> originated in the code.
                    >>>>
                    >>>> Exception Details: System.Argument Exception: Keyword not supported: 'provider'.
                    >>>>
                    >>>> Source Error:
                    >>>>
                    >>>> Line 28:
                    >>>> Line 29: Private Sub btnExecute_Clic k(ByVal sender As System.Object, ByVal e As
                    >>>> System.EventArg s) Handles btnExecute.Clic k
                    >>>> Line 30: Dim myconnection As New
                    >>>> System.Data.Sql Client.SqlConne ction("Provider =SQLOLEDB.1;Int egrated
                    >>>> Security=SSPI;P ersist Security Info=False;Init ial Catalog=paprese nters;Data
                    >>>> Source=NJS;Use Procedure for Prepare=1;Auto Translate=True; Packet
                    >>>> Size=4096;Works tation
                    >>>> ID=NJS;Use Encryption for Data=False;Tag with column collation when possible=False" )
                    >>>> Line 31: Dim cmdTesting As New System.Data.Sql Client.SqlComma nd
                    >>>> Line 32: Dim dataadapter As New System.Data.Sql Client.SqlDataA dapter
                    >>>>
                    >>>> Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 30
                    >>>>
                    >>>> Stack Trace:
                    >>>>
                    >>>> [ArgumentExcepti on: Keyword not supported: 'provider'.]
                    >>>> System.Data.Com mon.DBConnectio nString.ParseIn ternal(Char[] connectionStrin g,
                    >>>> UdlSupport checkForUdl, NameValuePair& keychain) +1133
                    >>>> System.Data.Com mon.DBConnectio nString..ctor(S tring connectionStrin g, UdlSupport
                    >>>> checkForUdl) +114
                    >>>> System.Data.Sql Client.SqlConne ctionString..ct or(String connectionStrin g) +13
                    >>>> System.Data.Sql Client.SqlConne ctionString.Par seString(String connectionStrin g) +96
                    >>>> System.Data.Sql Client.SqlConne ction.set_Conne ctionString(Str ing value) +11
                    >>>> System.Data.Sql Client.SqlConne ction..ctor(Str ing connectionStrin g) +158
                    >>>> PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                    >>>> c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:30
                    >>>> System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
                    >>>>
                    >>>> System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
                    >>>> eventArgument) +57
                    >>>> System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String
                    >>>> eventArgument) +18
                    >>>> System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
                    >>>> System.Web.UI.P age.ProcessRequ estMain() +1292
                    >>>>
                    >>>>
                    >>>>
                    >>>> --------------------------------------------------------------------------------
                    >>>> Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
                    >>>> Version:1.1.432 2.2032
                    >>>>
                    >>>>
                    >>>>
                    >>>> Although I don't know much about connectionstrin gs, the little bit of experience I
                    >>>> have
                    >>>> leads me to think that the connectionstrin g generated by Visual Studio .NET has a lot
                    >>>> more stuff in it than necessary, but either way it is not working. Why is this, and
                    >>>> how
                    >>>> can I fix it? Thanks.
                    >>>> --
                    >>>> Nathan Sokalski
                    >>>> njsokalski@hotm ail.com
                    >>>> http://www.nathansokalski.com/
                    >>>>
                    >>>> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                    >>>> news:e8E%23LaEe FHA.1136@TK2MSF TNGP12.phx.gbl. ..
                    >>>>>
                    >>>>> 1. Create at least one empty table in that database,
                    >>>>> using the Server Explorer.
                    >>>>>
                    >>>>> 2. Use the Server Explorer's "Add Connection" wizard
                    >>>>> ( right-click "Data Connections" ) to create a connection.
                    >>>>>
                    >>>>> 3. The connection string will be created for you.
                    >>>>>
                    >>>>> 4. Right-click the created connection and select Properties.
                    >>>>>
                    >>>>> 5. Copy the connection string from the "Properties " box.
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>> Juan T. Llibre
                    >>>>> ASP.NET MVP
                    >>>>> http://asp.net.do/foros/
                    >>>>> Foros de ASP.NET en Español
                    >>>>> Ven, y hablemos de ASP.NET...
                    >>>>> =============== =======
                    >>>>>
                    >>>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                    >>>>> news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...
                    >>>>>>I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
                    >>>>>> have created an empty database using Visual Studio .NET's Server Explorer.
                    >>>>>> However, I am having trouble connecting to the database using ASP.NET. I
                    >>>>>> think the problem is somewhere in my connection string, but because I do not
                    >>>>>> know much about connection strings, I am not sure what it should look like.
                    >>>>>> Can someone please help me determine what my connection string should look
                    >>>>>> like? I am using the version of IIS that comes with XP Pro. Thanks.
                    >>>>>> --
                    >>>>>> Nathan Sokalski
                    >>>>>> njsokalski@hotm ail.com
                    >>>>>> http://www.nathansokalski.com/
                    >>>>>>
                    >>>>>>
                    >>>>>>
                    >>>>>
                    >>>>>
                    >>>>
                    >>>>
                    >>>
                    >>>[/color]
                    >>
                    >>[/color]
                    >
                    >[/color]


                    Comment

                    • Cor Ligthert

                      #11
                      Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

                      Nathan,

                      Can you create something as this

                      \\\
                      Dim conn As New SqlClient.SqlCo nnection("Serve r=MyServerName; " & _
                      "DataBase=MyDat aBase; Integrated Security=SSPI")
                      Dim cmdTesting as new SqlClient.SQLCo mmand(txtSQLSta temement.Text,C onn)
                      Try
                      conn.open
                      try
                      cmdTesting.Exec uteNonQuery()
                      Catch ex as exception
                      response.redire ct("ex.Tostring ")
                      End Try
                      Catch ex as exception
                      response.Redire ct("ex.Tostring ")
                      Finally
                      conn.close
                      End Try
                      ///

                      The reason of the error should now be showed on the page.

                      I hope this helps,

                      Cor


                      Comment

                      • Nathan Sokalski

                        #12
                        Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

                        Yes, I used the ones you suggested.
                        --
                        Nathan Sokalski
                        njsokalski@hotm ail.com
                        有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


                        "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                        news:%23pcIkDHe FHA.2700@tk2msf tngp13.phx.gbl. ..[color=blue]
                        > Did you try the connection strings I suggested,
                        > or are you still using the other connection strings ?
                        >
                        >
                        >
                        > Juan T. Llibre
                        > ASP.NET MVP
                        > http://asp.net.do/foros/
                        > Foros de ASP.NET en Español
                        > Ven, y hablemos de ASP.NET...
                        > =============== =======
                        >
                        > "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                        > news:esNBVAHeFH A.1920@tk2msftn gp13.phx.gbl...[color=green]
                        >>I eventually got past the Login Failed error by adding permissions for
                        >>NJS\ASPNET to the database file. However, I am now recieving the following
                        >>error:
                        >>
                        >>
                        >> Server Error in '/PAPresenters' Application.
                        >> --------------------------------------------------------------------------------
                        >>
                        >> SQL Server does not exist or access denied.
                        >> Description: An unhandled exception occurred during the execution of the
                        >> current web request. Please review the stack trace for more information
                        >> about the error and where it originated in the code.
                        >>
                        >> Exception Details: System.Data.Sql Client.SqlExcep tion: SQL Server does
                        >> not exist or access denied.
                        >>
                        >> Source Error:
                        >>
                        >> Line 33: cmdTesting.Comm andText = txtSQLStatement .Text
                        >> Line 34: cmdTesting.Conn ection = myconnection
                        >> Line 35: myconnection.Op en()
                        >> Line 36: cmdTesting.Exec uteNonQuery()
                        >> Line 37: myconnection.Cl ose()
                        >>
                        >> Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 35
                        >>
                        >> Stack Trace:
                        >>
                        >> [SqlException: SQL Server does not exist or access denied.]
                        >> System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
                        >> isInTransaction ) +474
                        >>
                        >> System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
                        >> options, Boolean& isInTransaction ) +372
                        >> System.Data.Sql Client.SqlConne ction.Open() +384
                        >> PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                        >> c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:35
                        >> System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
                        >>
                        >> System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
                        >> eventArgument) +57
                        >> System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
                        >> sourceControl, String eventArgument) +18
                        >> System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
                        >> System.Web.UI.P age.ProcessRequ estMain() +1292
                        >>
                        >>
                        >>
                        >> --------------------------------------------------------------------------------
                        >> Version Information: Microsoft .NET Framework Version:1.1.432 2.2032;
                        >> ASP.NET Version:1.1.432 2.2032
                        >>
                        >>
                        >> I have SQL Server Desktop Engine running (when I hover my cursor over the
                        >> icon in the system tray it says "Running - \\NJS - MSSQLSERVER" and the
                        >> icon shows the green arrow, which means it is running). What am I not
                        >> doing? Thank you very much for your help, I greatly appreciate the quick
                        >> responses.
                        >> --
                        >> Nathan Sokalski
                        >> njsokalski@hotm ail.com
                        >> http://www.nathansokalski.com/
                        >>
                        >> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                        >> news:%23XkXgEGe FHA.1400@TK2MSF TNGP15.phx.gbl. ..[color=darkred]
                        >>>I think I tried it under .NET Beta 2, instead of .NET 1.1.
                        >>> Nevertheless, try the simpler connection string I suggested.
                        >>>
                        >>> Per
                        >>> http://msdn.microsoft.com/library/de...2000webapp.asp
                        >>> a slightly more optimized connection string is :
                        >>>
                        >>> "Server=localho st;Database=Pic s2Share;Trusted _Connection=Tru e;
                        >>> Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                        >>>
                        >>> But the simpler connection string I suggested
                        >>> should give you basic connectivity :
                        >>>
                        >>> "Server=NJS;Int egrated Security=True;D atabase=paprese nters"
                        >>>
                        >>> The optimized connection string for your case would be :
                        >>>
                        >>> "Server=NJS;Dat abase=papresent ers;Trusted_Con nection=True;
                        >>> Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                        >>>
                        >>> You could also use
                        >>> "Server=(local) ;Database=papre senters;Trusted _Connection=Tru e;
                        >>> Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                        >>>
                        >>> Using Trusted_Connect ion should prevent the error you're getting:
                        >>> Login failed for user 'NJS\ASPNET'.
                        >>>
                        >>>
                        >>>
                        >>> Juan T. Llibre
                        >>> ASP.NET MVP
                        >>> http://asp.net.do/foros/
                        >>> Foros de ASP.NET en Español
                        >>> Ven, y hablemos de ASP.NET...
                        >>> =============== =======
                        >>>
                        >>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                        >>> news:Oi55kZFeFH A.2844@TK2MSFTN GP14.phx.gbl...
                        >>> That is not one of the listed providers. the listed providers that are
                        >>> brought up are:
                        >>>
                        >>> If there is somewhere on the web that I can download the provider you
                        >>> mentioned from, I would like to know about it, but right now all I have
                        >>> are the ones shown above. Thanks.
                        >>> --
                        >>> Nathan Sokalski
                        >>> njsokalski@hotm ail.com
                        >>> http://www.nathansokalski.com/
                        >>>
                        >>> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                        >>> news:exM$pAFeFH A.1328@TK2MSFTN GP12.phx.gbl...
                        >>>> It looks like you selected the wrong provider when creating the
                        >>>> connection.
                        >>>>
                        >>>> You should select the ".NET Framework Data Provider for SQL Server"
                        >>>> for a provider.
                        >>>>
                        >>>> Try it using that provider. You should get a correct string if you do.
                        >>>>
                        >>>> If you still have problems, try a simpler connection string :
                        >>>>
                        >>>> "Server=NJS;Int egrated Security=True;D atabase=paprese nters"
                        >>>>
                        >>>> That assumes that your MSDE's instance name is "NJS"
                        >>>> and that your database name is "papresente rs".
                        >>>>
                        >>>>
                        >>>>
                        >>>>
                        >>>> Juan T. Llibre
                        >>>> ASP.NET MVP
                        >>>> http://asp.net.do/foros/
                        >>>> Foros de ASP.NET en Español
                        >>>> Ven, y hablemos de ASP.NET...
                        >>>> =============== =======
                        >>>>
                        >>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                        >>>> news:esCnY4EeFH A.1404@TK2MSFTN GP09.phx.gbl...
                        >>>>>I have tried that, but the connectionstrin g that is created has plenty
                        >>>>>of stuff in it
                        >>>>>that gives me errors. For example:
                        >>>>>
                        >>>>>
                        >>>>>
                        >>>>> Server Error in '/PAPresenters' Application.
                        >>>>> --------------------------------------------------------------------------------
                        >>>>>
                        >>>>> Keyword not supported: 'provider'.
                        >>>>> Description: An unhandled exception occurred during the execution of
                        >>>>> the current web
                        >>>>> request. Please review the stack trace for more information about the
                        >>>>> error and where it
                        >>>>> originated in the code.
                        >>>>>
                        >>>>> Exception Details: System.Argument Exception: Keyword not supported:
                        >>>>> 'provider'.
                        >>>>>
                        >>>>> Source Error:
                        >>>>>
                        >>>>> Line 28:
                        >>>>> Line 29: Private Sub btnExecute_Clic k(ByVal sender As
                        >>>>> System.Object, ByVal e As
                        >>>>> System.EventArg s) Handles btnExecute.Clic k
                        >>>>> Line 30: Dim myconnection As New
                        >>>>> System.Data.Sql Client.SqlConne ction("Provider =SQLOLEDB.1;Int egrated
                        >>>>> Security=SSPI;P ersist Security Info=False;Init ial
                        >>>>> Catalog=paprese nters;Data
                        >>>>> Source=NJS;Use Procedure for Prepare=1;Auto Translate=True; Packet
                        >>>>> Size=4096;Works tation
                        >>>>> ID=NJS;Use Encryption for Data=False;Tag with column collation when
                        >>>>> possible=False" )
                        >>>>> Line 31: Dim cmdTesting As New
                        >>>>> System.Data.Sql Client.SqlComma nd
                        >>>>> Line 32: Dim dataadapter As New
                        >>>>> System.Data.Sql Client.SqlDataA dapter
                        >>>>>
                        >>>>> Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line:
                        >>>>> 30
                        >>>>>
                        >>>>> Stack Trace:
                        >>>>>
                        >>>>> [ArgumentExcepti on: Keyword not supported: 'provider'.]
                        >>>>> System.Data.Com mon.DBConnectio nString.ParseIn ternal(Char[]
                        >>>>> connectionStrin g,
                        >>>>> UdlSupport checkForUdl, NameValuePair& keychain) +1133
                        >>>>> System.Data.Com mon.DBConnectio nString..ctor(S tring connectionStrin g,
                        >>>>> UdlSupport
                        >>>>> checkForUdl) +114
                        >>>>> System.Data.Sql Client.SqlConne ctionString..ct or(String
                        >>>>> connectionStrin g) +13
                        >>>>> System.Data.Sql Client.SqlConne ctionString.Par seString(String
                        >>>>> connectionStrin g) +96
                        >>>>> System.Data.Sql Client.SqlConne ction.set_Conne ctionString(Str ing
                        >>>>> value) +11
                        >>>>> System.Data.Sql Client.SqlConne ction..ctor(Str ing connectionStrin g)
                        >>>>> +158
                        >>>>> PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                        >>>>> c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:30
                        >>>>> System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
                        >>>>>
                        >>>>> System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
                        >>>>> eventArgument) +57
                        >>>>> System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
                        >>>>> sourceControl, String
                        >>>>> eventArgument) +18
                        >>>>> System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
                        >>>>> +33
                        >>>>> System.Web.UI.P age.ProcessRequ estMain() +1292
                        >>>>>
                        >>>>>
                        >>>>>
                        >>>>> --------------------------------------------------------------------------------
                        >>>>> Version Information: Microsoft .NET Framework Version:1.1.432 2.2032;
                        >>>>> ASP.NET
                        >>>>> Version:1.1.432 2.2032
                        >>>>>
                        >>>>>
                        >>>>>
                        >>>>> Although I don't know much about connectionstrin gs, the little bit of
                        >>>>> experience I have
                        >>>>> leads me to think that the connectionstrin g generated by Visual Studio
                        >>>>> .NET has a lot
                        >>>>> more stuff in it than necessary, but either way it is not working. Why
                        >>>>> is this, and how
                        >>>>> can I fix it? Thanks.
                        >>>>> --
                        >>>>> Nathan Sokalski
                        >>>>> njsokalski@hotm ail.com
                        >>>>> http://www.nathansokalski.com/
                        >>>>>
                        >>>>> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                        >>>>> news:e8E%23LaEe FHA.1136@TK2MSF TNGP12.phx.gbl. ..
                        >>>>>>
                        >>>>>> 1. Create at least one empty table in that database,
                        >>>>>> using the Server Explorer.
                        >>>>>>
                        >>>>>> 2. Use the Server Explorer's "Add Connection" wizard
                        >>>>>> ( right-click "Data Connections" ) to create a connection.
                        >>>>>>
                        >>>>>> 3. The connection string will be created for you.
                        >>>>>>
                        >>>>>> 4. Right-click the created connection and select Properties.
                        >>>>>>
                        >>>>>> 5. Copy the connection string from the "Properties " box.
                        >>>>>>
                        >>>>>>
                        >>>>>>
                        >>>>>>
                        >>>>>> Juan T. Llibre
                        >>>>>> ASP.NET MVP
                        >>>>>> http://asp.net.do/foros/
                        >>>>>> Foros de ASP.NET en Español
                        >>>>>> Ven, y hablemos de ASP.NET...
                        >>>>>> =============== =======
                        >>>>>>
                        >>>>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                        >>>>>> news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...
                        >>>>>>>I have Visual Studio .NET and SQL Server Desktop Engine on my
                        >>>>>>>computer . I
                        >>>>>>> have created an empty database using Visual Studio .NET's Server
                        >>>>>>> Explorer.
                        >>>>>>> However, I am having trouble connecting to the database using
                        >>>>>>> ASP.NET. I
                        >>>>>>> think the problem is somewhere in my connection string, but because
                        >>>>>>> I do not
                        >>>>>>> know much about connection strings, I am not sure what it should
                        >>>>>>> look like.
                        >>>>>>> Can someone please help me determine what my connection string
                        >>>>>>> should look
                        >>>>>>> like? I am using the version of IIS that comes with XP Pro. Thanks.
                        >>>>>>> --
                        >>>>>>> Nathan Sokalski
                        >>>>>>> njsokalski@hotm ail.com
                        >>>>>>> http://www.nathansokalski.com/
                        >>>>>>>
                        >>>>>>>
                        >>>>>>>
                        >>>>>>
                        >>>>>>
                        >>>>>
                        >>>>>
                        >>>>
                        >>>>
                        >>>
                        >>>[/color]
                        >>
                        >>[/color]
                        >
                        >[/color]


                        Comment

                        • Nathan Sokalski

                          #13
                          Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

                          I ran the following code:

                          Dim conn As New
                          SqlClient.SqlCo nnection("Serve r=MyServerName; DataBase=MyData Base;Integrated
                          Security=SSPI")

                          Dim cmdTesting As New SqlClient.SqlCo mmand(txtSQLSta tement.Text, conn)

                          Try

                          conn.Open()

                          Try

                          cmdTesting.Exec uteNonQuery()

                          Catch ex As Exception

                          Response.Write( ex.Tostring)

                          End Try

                          Catch ex As Exception

                          Response.Write( ex.Tostring)

                          Finally

                          conn.Close()

                          End Try


                          Which returned the following error:

                          System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or access
                          denied. at System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
                          isInTransaction ) at
                          System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
                          options, Boolean& isInTransaction ) at
                          System.Data.Sql Client.SqlConne ction.Open() at
                          PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                          c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:line 41

                          This is the same error and part of the code that I have been before (line 41
                          is the conn.Open() line). I am guessing, based on everything that has
                          happened so far, that the problem is not in my code, but somewhere in the
                          setup of MSDE (because ASP.NET obviously isn't detecting it). When I start
                          MSDE using "SQL Server Service Manager" (a tiny utility that does nothing
                          other than make it easier to start/pause/stop the service), the service that
                          I select is "SQL Server". There are also 2 other services that can be
                          started/stopped using this utility which are "SQL Server Agent" and
                          "Distribute d Transaction Coordinator". Is it possible I need to do something
                          with one of these also?
                          --
                          Nathan Sokalski
                          njsokalski@hotm ail.com
                          有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

                          "Cor Ligthert" <notmyfirstname @planet.nl> wrote in message
                          news:O8CNJ$HeFH A.3880@tk2msftn gp13.phx.gbl...[color=blue]
                          > Nathan,
                          >
                          > Can you create something as this
                          >
                          > \\\
                          > Dim conn As New SqlClient.SqlCo nnection("Serve r=MyServerName; " & _
                          > "DataBase=MyDat aBase; Integrated Security=SSPI")
                          > Dim cmdTesting as new SqlClient.SQLCo mmand(txtSQLSta temement.Text,C onn)
                          > Try
                          > conn.open
                          > try
                          > cmdTesting.Exec uteNonQuery()
                          > Catch ex as exception
                          > response.redire ct("ex.Tostring ")
                          > End Try
                          > Catch ex as exception
                          > response.Redire ct("ex.Tostring ")
                          > Finally
                          > conn.close
                          > End Try
                          > ///
                          >
                          > The reason of the error should now be showed on the page.
                          >
                          > I hope this helps,
                          >
                          > Cor
                          >[/color]


                          Comment

                          • Juan T. Llibre

                            #14
                            Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

                            Did you try :

                            "Server=NJS;Tru sted_Connection =True;Database= papresenters"

                            ?

                            On a box where both the web server and MSDE are running, that should connect.
                            Is there anything else you're doing that you haven't told us ?

                            Did you read
                            http://msdn.microsoft.com/library/de...2000webapp.asp

                            ?

                            There's code samples there which I *know* work.



                            Juan T. Llibre
                            ASP.NET MVP

                            Foros de ASP.NET en Español
                            Ven, y hablemos de ASP.NET...
                            =============== =======

                            "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                            news:O3GCZ%23Pe FHA.2556@TK2MSF TNGP10.phx.gbl. ..[color=blue]
                            > Yes, I used the ones you suggested.
                            > --
                            > Nathan Sokalski
                            > njsokalski@hotm ail.com
                            > http://www.nathansokalski.com/
                            >
                            > "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                            > news:%23pcIkDHe FHA.2700@tk2msf tngp13.phx.gbl. ..[color=green]
                            >> Did you try the connection strings I suggested,
                            >> or are you still using the other connection strings ?
                            >>
                            >>
                            >>
                            >> Juan T. Llibre
                            >> ASP.NET MVP
                            >> http://asp.net.do/foros/
                            >> Foros de ASP.NET en Español
                            >> Ven, y hablemos de ASP.NET...
                            >> =============== =======
                            >>
                            >> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                            >> news:esNBVAHeFH A.1920@tk2msftn gp13.phx.gbl...[color=darkred]
                            >>>I eventually got past the Login Failed error by adding permissions for NJS\ASPNET to
                            >>>the database file. However, I am now recieving the following error:
                            >>>
                            >>>
                            >>> Server Error in '/PAPresenters' Application.
                            >>> --------------------------------------------------------------------------------
                            >>>
                            >>> SQL Server does not exist or access denied.
                            >>> Description: An unhandled exception occurred during the execution of the current web
                            >>> request. Please review the stack trace for more information about the error and where
                            >>> it originated in the code.
                            >>>
                            >>> Exception Details: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
                            >>> access denied.
                            >>>
                            >>> Source Error:
                            >>>
                            >>> Line 33: cmdTesting.Comm andText = txtSQLStatement .Text
                            >>> Line 34: cmdTesting.Conn ection = myconnection
                            >>> Line 35: myconnection.Op en()
                            >>> Line 36: cmdTesting.Exec uteNonQuery()
                            >>> Line 37: myconnection.Cl ose()
                            >>>
                            >>> Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 35
                            >>>
                            >>> Stack Trace:
                            >>>
                            >>> [SqlException: SQL Server does not exist or access denied.]
                            >>> System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean& isInTransaction ) +474
                            >>>
                            >>> System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
                            >>> options, Boolean& isInTransaction ) +372
                            >>> System.Data.Sql Client.SqlConne ction.Open() +384
                            >>> PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                            >>> c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:35
                            >>> System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
                            >>>
                            >>> System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
                            >>> eventArgument) +57
                            >>> System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String
                            >>> eventArgument) +18
                            >>> System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
                            >>> System.Web.UI.P age.ProcessRequ estMain() +1292
                            >>>
                            >>>
                            >>>
                            >>> --------------------------------------------------------------------------------
                            >>> Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
                            >>> Version:1.1.432 2.2032
                            >>>
                            >>>
                            >>> I have SQL Server Desktop Engine running (when I hover my cursor over the icon in the
                            >>> system tray it says "Running - \\NJS - MSSQLSERVER" and the icon shows the green
                            >>> arrow, which means it is running). What am I not doing? Thank you very much for your
                            >>> help, I greatly appreciate the quick responses.
                            >>> --
                            >>> Nathan Sokalski
                            >>> njsokalski@hotm ail.com
                            >>> http://www.nathansokalski.com/
                            >>>
                            >>> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                            >>> news:%23XkXgEGe FHA.1400@TK2MSF TNGP15.phx.gbl. ..
                            >>>>I think I tried it under .NET Beta 2, instead of .NET 1.1.
                            >>>> Nevertheless, try the simpler connection string I suggested.
                            >>>>
                            >>>> Per
                            >>>> http://msdn.microsoft.com/library/de...2000webapp.asp
                            >>>> a slightly more optimized connection string is :
                            >>>>
                            >>>> "Server=localho st;Database=Pic s2Share;Trusted _Connection=Tru e;
                            >>>> Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                            >>>>
                            >>>> But the simpler connection string I suggested
                            >>>> should give you basic connectivity :
                            >>>>
                            >>>> "Server=NJS;Tru sted_Connection =True;Database= papresenters"
                            >>>>
                            >>>> The optimized connection string for your case would be :
                            >>>>
                            >>>> "Server=NJS;Dat abase=papresent ers;Trusted_Con nection=True;
                            >>>> Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                            >>>>
                            >>>> You could also use
                            >>>> "Server=(local) ;Database=papre senters;Trusted _Connection=Tru e;
                            >>>> Connection Timeout=60;Pool ing=True;Min Pool Size=1;Max Pool Size=5"
                            >>>>
                            >>>> Using Trusted_Connect ion should prevent the error you're getting:
                            >>>> Login failed for user 'NJS\ASPNET'.
                            >>>>
                            >>>>
                            >>>>
                            >>>> Juan T. Llibre
                            >>>> ASP.NET MVP
                            >>>> http://asp.net.do/foros/
                            >>>> Foros de ASP.NET en Español
                            >>>> Ven, y hablemos de ASP.NET...
                            >>>> =============== =======
                            >>>>
                            >>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                            >>>> news:Oi55kZFeFH A.2844@TK2MSFTN GP14.phx.gbl...
                            >>>> That is not one of the listed providers. the listed providers that are brought up
                            >>>> are:
                            >>>>
                            >>>> If there is somewhere on the web that I can download the provider you mentioned from,
                            >>>> I would like to know about it, but right now all I have are the ones shown above.
                            >>>> Thanks.
                            >>>> --
                            >>>> Nathan Sokalski
                            >>>> njsokalski@hotm ail.com
                            >>>> http://www.nathansokalski.com/
                            >>>>
                            >>>> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                            >>>> news:exM$pAFeFH A.1328@TK2MSFTN GP12.phx.gbl...
                            >>>>> It looks like you selected the wrong provider when creating the connection.
                            >>>>>
                            >>>>> You should select the ".NET Framework Data Provider for SQL Server"
                            >>>>> for a provider.
                            >>>>>
                            >>>>> Try it using that provider. You should get a correct string if you do.
                            >>>>>
                            >>>>> If you still have problems, try a simpler connection string :
                            >>>>>
                            >>>>> "Server=NJS;Tru sted_Connection =True;Database= papresenters"
                            >>>>>
                            >>>>> That assumes that your MSDE's instance name is "NJS"
                            >>>>> and that your database name is "papresente rs".
                            >>>>>
                            >>>>>
                            >>>>> Juan T. Llibre
                            >>>>> ASP.NET MVP
                            >>>>> http://asp.net.do/foros/
                            >>>>> Foros de ASP.NET en Español
                            >>>>> Ven, y hablemos de ASP.NET...
                            >>>>> =============== =======
                            >>>>>
                            >>>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                            >>>>> news:esCnY4EeFH A.1404@TK2MSFTN GP09.phx.gbl...
                            >>>>>>I have tried that, but the connectionstrin g that is created has plenty of stuff in
                            >>>>>>it
                            >>>>>>that gives me errors. For example:
                            >>>>>>
                            >>>>>>
                            >>>>>>
                            >>>>>> Server Error in '/PAPresenters' Application.
                            >>>>>> --------------------------------------------------------------------------------
                            >>>>>>
                            >>>>>> Keyword not supported: 'provider'.
                            >>>>>> Description: An unhandled exception occurred during the execution of the current
                            >>>>>> web
                            >>>>>> request. Please review the stack trace for more information about the error and
                            >>>>>> where it
                            >>>>>> originated in the code.
                            >>>>>>
                            >>>>>> Exception Details: System.Argument Exception: Keyword not supported: 'provider'.
                            >>>>>>
                            >>>>>> Source Error:
                            >>>>>>
                            >>>>>> Line 28:
                            >>>>>> Line 29: Private Sub btnExecute_Clic k(ByVal sender As System.Object, ByVal e As
                            >>>>>> System.EventArg s) Handles btnExecute.Clic k
                            >>>>>> Line 30: Dim myconnection As New
                            >>>>>> System.Data.Sql Client.SqlConne ction("Provider =SQLOLEDB.1;Int egrated
                            >>>>>> Security=SSPI;P ersist Security Info=False;Init ial Catalog=paprese nters;Data
                            >>>>>> Source=NJS;Use Procedure for Prepare=1;Auto Translate=True; Packet
                            >>>>>> Size=4096;Works tation
                            >>>>>> ID=NJS;Use Encryption for Data=False;Tag with column collation when
                            >>>>>> possible=False" )
                            >>>>>> Line 31: Dim cmdTesting As New System.Data.Sql Client.SqlComma nd
                            >>>>>> Line 32: Dim dataadapter As New System.Data.Sql Client.SqlDataA dapter
                            >>>>>>
                            >>>>>> Source File: c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b Line: 30
                            >>>>>>
                            >>>>>> Stack Trace:
                            >>>>>>
                            >>>>>> [ArgumentExcepti on: Keyword not supported: 'provider'.]
                            >>>>>> System.Data.Com mon.DBConnectio nString.ParseIn ternal(Char[] connectionStrin g,
                            >>>>>> UdlSupport checkForUdl, NameValuePair& keychain) +1133
                            >>>>>> System.Data.Com mon.DBConnectio nString..ctor(S tring connectionStrin g, UdlSupport
                            >>>>>> checkForUdl) +114
                            >>>>>> System.Data.Sql Client.SqlConne ctionString..ct or(String connectionStrin g) +13
                            >>>>>> System.Data.Sql Client.SqlConne ctionString.Par seString(String connectionStrin g)
                            >>>>>> +96
                            >>>>>> System.Data.Sql Client.SqlConne ction.set_Conne ctionString(Str ing value) +11
                            >>>>>> System.Data.Sql Client.SqlConne ction..ctor(Str ing connectionStrin g) +158
                            >>>>>> PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                            >>>>>> c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:30
                            >>>>>> System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
                            >>>>>>
                            >>>>>> System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
                            >>>>>> eventArgument) +57
                            >>>>>> System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String
                            >>>>>> eventArgument) +18
                            >>>>>> System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
                            >>>>>> System.Web.UI.P age.ProcessRequ estMain() +1292
                            >>>>>>
                            >>>>>>
                            >>>>>>
                            >>>>>> --------------------------------------------------------------------------------
                            >>>>>> Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
                            >>>>>> Version:1.1.432 2.2032
                            >>>>>>
                            >>>>>>
                            >>>>>>
                            >>>>>> Although I don't know much about connectionstrin gs, the little bit of experience I
                            >>>>>> have
                            >>>>>> leads me to think that the connectionstrin g generated by Visual Studio .NET has a
                            >>>>>> lot
                            >>>>>> more stuff in it than necessary, but either way it is not working. Why is this, and
                            >>>>>> how
                            >>>>>> can I fix it? Thanks.
                            >>>>>> --
                            >>>>>> Nathan Sokalski
                            >>>>>> njsokalski@hotm ail.com
                            >>>>>> http://www.nathansokalski.com/
                            >>>>>>
                            >>>>>> "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                            >>>>>> news:e8E%23LaEe FHA.1136@TK2MSF TNGP12.phx.gbl. ..
                            >>>>>>>
                            >>>>>>> 1. Create at least one empty table in that database,
                            >>>>>>> using the Server Explorer.
                            >>>>>>>
                            >>>>>>> 2. Use the Server Explorer's "Add Connection" wizard
                            >>>>>>> ( right-click "Data Connections" ) to create a connection.
                            >>>>>>>
                            >>>>>>> 3. The connection string will be created for you.
                            >>>>>>>
                            >>>>>>> 4. Right-click the created connection and select Properties.
                            >>>>>>>
                            >>>>>>> 5. Copy the connection string from the "Properties " box.
                            >>>>>>>
                            >>>>>>>
                            >>>>>>>
                            >>>>>>>
                            >>>>>>> Juan T. Llibre
                            >>>>>>> ASP.NET MVP
                            >>>>>>> http://asp.net.do/foros/
                            >>>>>>> Foros de ASP.NET en Español
                            >>>>>>> Ven, y hablemos de ASP.NET...
                            >>>>>>> =============== =======
                            >>>>>>>
                            >>>>>>> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                            >>>>>>> news:e7ceEVEeFH A.3712@TK2MSFTN GP09.phx.gbl...
                            >>>>>>>>I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I
                            >>>>>>>> have created an empty database using Visual Studio .NET's Server Explorer.
                            >>>>>>>> However, I am having trouble connecting to the database using ASP.NET. I
                            >>>>>>>> think the problem is somewhere in my connection string, but because I do not
                            >>>>>>>> know much about connection strings, I am not sure what it should look like.
                            >>>>>>>> Can someone please help me determine what my connection string should look
                            >>>>>>>> like? I am using the version of IIS that comes with XP Pro. Thanks.[/color][/color][/color]


                            Comment

                            • Juan T. Llibre

                              #15
                              Re: MSDE, ASP.NET, Visual Studio .NET, and connectionstrin gs

                              Nathan, try this :

                              Dim conn As New
                              SqlClient.SqlCo nnection("Serve r=NJS;Trusted_C onnection=True; Database=papres enters")

                              and leave the rest of the code as it is now.

                              re:[color=blue]
                              > There are also 2 other services that can be started/stopped using this utility which are
                              > "SQL Server Agent" and "Distribute d Transaction Coordinator". Is it possible I need to
                              > do something with one of these also?[/color]

                              No. You don't need to use those.




                              Juan T. Llibre
                              ASP.NET MVP

                              Foros de ASP.NET en Español
                              Ven, y hablemos de ASP.NET...
                              =============== =======

                              "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                              news:%23o9UwaQe FHA.2584@tk2msf tngp13.phx.gbl. ..[color=blue]
                              >I ran the following code:
                              >
                              > Dim conn As New
                              > SqlClient.SqlCo nnection("Serve r=MyServerName; DataBase=MyData Base;Integrated
                              > Security=SSPI")
                              >
                              > Dim cmdTesting As New SqlClient.SqlCo mmand(txtSQLSta tement.Text, conn)
                              >
                              > Try
                              >
                              > conn.Open()
                              >
                              > Try
                              >
                              > cmdTesting.Exec uteNonQuery()
                              >
                              > Catch ex As Exception
                              >
                              > Response.Write( ex.Tostring)
                              >
                              > End Try
                              >
                              > Catch ex As Exception
                              >
                              > Response.Write( ex.Tostring)
                              >
                              > Finally
                              >
                              > conn.Close()
                              >
                              > End Try
                              >
                              >
                              > Which returned the following error:
                              >
                              > System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or access denied. at
                              > System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean& isInTransaction ) at
                              > System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
                              > options, Boolean& isInTransaction ) at System.Data.Sql Client.SqlConne ction.Open() at
                              > PAPresenters.DB test.btnExecute _Click(Object sender, EventArgs e) in
                              > c:\inetpub\wwwr oot\PAPresenter s\DBtest.aspx.v b:line 41
                              >
                              > This is the same error and part of the code that I have been before (line 41 is the
                              > conn.Open() line). I am guessing, based on everything that has happened so far, that the
                              > problem is not in my code, but somewhere in the setup of MSDE (because ASP.NET obviously
                              > isn't detecting it). When I start MSDE using "SQL Server Service Manager" (a tiny
                              > utility that does nothing other than make it easier to start/pause/stop the service),
                              > the service that I select is "SQL Server". There are also 2 other services that can be
                              > started/stopped using this utility which are "SQL Server Agent" and "Distribute d
                              > Transaction Coordinator". Is it possible I need to do something with one of these also?
                              > --
                              > Nathan Sokalski
                              > njsokalski@hotm ail.com
                              > http://www.nathansokalski.com/
                              > "Cor Ligthert" <notmyfirstname @planet.nl> wrote in message
                              > news:O8CNJ$HeFH A.3880@tk2msftn gp13.phx.gbl...[color=green]
                              >> Nathan,
                              >>
                              >> Can you create something as this
                              >>
                              >> \\\
                              >> Dim conn As New SqlClient.SqlCo nnection("Serve r=MyServerName; " & _
                              >> "DataBase=MyDat aBase; Integrated Security=SSPI")
                              >> Dim cmdTesting as new SqlClient.SQLCo mmand(txtSQLSta temement.Text,C onn)
                              >> Try
                              >> conn.open
                              >> try
                              >> cmdTesting.Exec uteNonQuery()
                              >> Catch ex as exception
                              >> response.redire ct("ex.Tostring ")
                              >> End Try
                              >> Catch ex as exception
                              >> response.Redire ct("ex.Tostring ")
                              >> Finally
                              >> conn.close
                              >> End Try
                              >> ///
                              >>
                              >> The reason of the error should now be showed on the page.
                              >>
                              >> I hope this helps,
                              >>
                              >> Cor
                              >>[/color]
                              >
                              >[/color]


                              Comment

                              Working...