WinForms compilation NuGet



  • To connect to sql server used the ready DataConnectionDialog from the package.
    https://www.nuget.org/packages/DataConnectionDialog ♪

    I think I've done it properly, but when compiling exception,

    Additional information:

    No resources could be found culture or neutral culture. Check the right thing. implementation or liaison "Microsoft.Data.ConnectionUI.Resources.resources" "BandivanKatUser" during the compilation, or make sure that everything the necessary accompanying assemblies are fully signed and may be loaded.

    It's a code where the exception goes:

    public static DataProvider SqlCeDataProvider 
    {
        get 
        {
            if (_sqlCeDataProvider == null) 
            {
                Dictionary<string, string> descriptions = new Dictionary<string, string>();
                descriptions.Add(SqlCeDataSource.Name, 
                    Resources.DataProvider_SqlEverywhere_Description);
    
            Dictionary&lt;string, Type&gt; uiControls = new Dictionary&lt;string, Type&gt;();
            uiControls.Add(String.Empty, typeof(SqlCeConnectionUIControl));
    
            _sqlCeDataProvider = new DataProvider(
                "System.Data.SqlCeClient",
                Resources.DataProvider_SqlEverywhere,
                "SqlCeClient",
                Resources.DataProvider_SqlEverywhere_Description,
                typeof(System.Data.SqlServerCe.SqlCeConnection),
                descriptions,
                uiControls,
                typeof(SqlCeConnectionProperties));
        }
        return _sqlCeDataProvider;
    }
    

    }

    That's the line:

    descriptions.Add(SqlCeDataSource.Name, Resources.DataProvider_SqlEverywhere_Description);



  • #r "Microsoft.Data.ConnectionUI"
    #r "Microsoft.Data.ConnectionUI.Dialog"
    
    using Microsoft.Data.ConnectionUI;
    
    static private string GetConnectionString() {
        DataConnectionDialog dcd = new DataConnectionDialog();
        DataSource.AddStandardDataSources(dcd);
        return DataConnectionDialog.Show(dcd) == DialogResult.OK ? dcd.ConnectionString : null;
    }
    
    var f = new Form();
    new Button() { Text="Connect", Parent = f }.Click += (s, e) => {
        var cs = GetConnectionString();
        // ...
    };
    f.ShowDialog();
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2