changing connection string from different servers to get report in c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adeel shahid
    New Member
    • Sep 2007
    • 4

    changing connection string from different servers to get report in c#

    I m using .NET Crystal Report but i have to create report using different servers. right now the connection string is static using store procedure but i want to change the connection string at runtime using the storeprocedure.
    Can any one help that how can i create a report using a different server address using storeprocedure and dataset.

    Thanks

    Adeel Shahid
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Is the stored procedure on the other server?
    Just create multiple connection strings, thatn you can use the one you want, when you want.

    Comment

    • adeel shahid
      New Member
      • Sep 2007
      • 4

      #3
      thanx for replying

      the storeprocedure and database name on the other server is same but the server name is change.

      the suggestion u gave i was unable to get it properly can u give any code example for that. i need it as early as possible

      i will be grateful to you

      Thanks

      Adeel Shahid

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        string constring1=<som e connection string for server1>;
        string constring2=<som e connection string for server2>;


        Then depending on which one you want, just use the correct connection string on your database connection object?

        Comment

        • adeel shahid
          New Member
          • Sep 2007
          • 4

          #5
          thanks for reply

          but we need to change the string on runtime. as user connects from internal or external server the connection string should be according to the login.


          thanks

          Adeel Shahid

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            ok then do that.
            Based on the login, decide which connection string to use.


            If you are unsure how to create a string at runtime, I would REALLY suggest you go through a tutorial on the basics of programming.

            Comment

            Working...