0

I'm trying to open SDE Workspace Factory using IWorkspaceFactory.Open

I give the complete Property set in the code to open.

ESRI.ArcGIS.esriSystem.IPropertySet propertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();
propertySet.SetProperty("SERVER", "myServer");
propertySet.SetProperty("INSTANCE", "myinstance");
propertySet.SetProperty("AUTHENTICATION_MODE", "DBMS");
propertySet.SetProperty("DATABASE", "myDatabase");
propertySet.SetProperty("USER", "sde");
propertySet.SetProperty("PASSWORD", "sdePassword");
propertySet.SetProperty("VERSION", "sde.DEFAUALT");


IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactory();
IWorkspace workspace = workspaceFactory.Open(propertySet,0);

But When the workspaceFactory.Open is called, a dialogue box is opened to ask for credentials again.

Connection Properties

Why does this happen?

Also, Can someone tell me what does the second parameter of IWorkspaceFactory.Open "hWnd" represent? I couldnt find a proper explanation in the documentation.

  • 2
    There aren't many reasons to ever hard-code the sde user password into an application. In fact, there aren't many reasons to ever connect as the sde user, period. – Vince Mar 10 at 13:08
  • 3
    You have a typo in the default version name. – JGH Mar 10 at 14:05
  • The hWnd argument is usually 0, it's the applications' hWnd resources.arcgis.com/en/help/arcobjects-net/componenthelp/… just in case you have implemented a custom connection dialog the IWorkspaceFactory.Open can find the application to create a proper child window... I have never used any value other than 0 for this argument. – Michael Stimson Mar 12 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.