PromptDataSource method

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

    PromptDataSource method

    When using Delphi, In order to create connection strings, there was a method
    to show Data Source creation page,

    string ConnStr = PromptDataSourc e();

    What is the C# equivalent of this method ?

    Thanks


  • Bill B

    #2
    Re: PromptDataSourc e method

    I don't know of a built-in mechanism to prompt the user for a data
    source selection in C#, but you should be able to build your own dialog
    and prompt the user for the relavent information and then construct a
    connection string.

    More details on prompting for UserID/Password and then building the
    connection string can be found at:



    Bill

    Comment

    • Bill Block

      #3
      Re: PromptDataSourc e method

      I don't know of a built-in mechanism to prompt the user for a data
      source selection in C#, but you should be able to build your own dialog
      and prompt the user for the relavent information and then construct a
      connection string.

      More details on prompting for UserID/Password and then building the
      connection string can be found at:

      http://msdn.microsoft.com/library/de...ary/en-us/vbco...

      Bill

      Comment

      • Polaris431

        #4
        Re: PromptDataSourc e method

        Add a reference to Microsoft.Data. ConnectionUI. This is located in the
        directory where VS is installed, eg:

        C:\Program Files\VS8\Commo n7\IDE\Microsof t.Data.Connecti onUI.dll

        Add the following code...

        using Microsoft.Data. ConnectionUI;

        ....

        Microsoft.Data. ConnectionUI.Da taConnectionDia log dcd = new
        Microsoft.Data. ConnectionUI.Da taConnectionDia log();

        Microsoft.Data. ConnectionUI.Da taSource.AddSta ndardDataSource s(dcd);

        if (Microsoft.Data .ConnectionUI.D ataConnectionDi alog.Show(dcd)
        == System.Windows. Forms.DialogRes ult.OK)
        {
        string buf = "Provider: " + dcd.SelectedDat aProvider.Name +
        "\r\n" + "ConnectionStri ng: " + dcd.ConnectionS tring;
        }

        This is an undocumented method of displaying the same dialog that
        VS.NET uses. But what the hack (I mean what the 'heck'). Some features
        eventually find their way into a product when enough users use the hack
        and Microsoft eventually catches on. This feature really should have
        been in the product from day one. You listening MS?

        Best Regards
        Polaris431

        Comment

        Working...