Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How to filter dataSource/DataProvider on IVsDataConnectionDialog

$
0
0

Hi,

I want to utilize VS standard DataConnectionDialog in  Microsoft.VisualStudio.Data.Services.dll to configure connectionstring of my app. When I use IVsDataConnectionDialog.AddAllSources method, everything is undercontrol, datasource/dataprovider will be added in dataconnectionDialog without problem. when I try to filter datasource/dataprovider, I could not get any success (please see sample code below). there is no any sample or demonstration in MSDN, Could you give me one success sample here?

        private static readonly Guid SQLServerDataSource = new Guid("067ea0d9-ba62-43f7-9106-34930c60c528");
        private static readonly Guid SQLServerDotNetProvider = new Guid("91510608-8809-4020-8897-fba057e22d54");

        private void ConnectionButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                IServiceProvider _serviceProvider = PackageContext.Package;
                var objIVsDataConnectionDialogFactory = _serviceProvider.GetService(typeof(IVsDataConnectionDialogFactory)) as IVsDataConnectionDialogFactory;
                var objIVsDataConnectionDialog = objIVsDataConnectionDialogFactory.CreateConnectionDialog();
                objIVsDataConnectionDialog.AddSources(SQLServerDataSource);
                //objIVsDataConnectionDialog.LoadSourceSelection();
                objIVsDataConnectionDialog.SelectedSource = SQLServerDataSource;
                objIVsDataConnectionDialog.SelectedProvider = SQLServerDotNetProvider;

Thanks,

Vince


everything is possible


Viewing all articles
Browse latest Browse all 4410

Trending Articles