Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 128
Registered: ‎01-14-2018

Unable to connect to a shapefile

[ Edited ]

Dear all,

 

I want to make a connection to a shapefile, and I used the following code:

 

        PClient.Connection pClientConnectionSHP_Points = this._currentApplication.CreateService("GeoMedia.Connection") as PClient.Connection;
        pClientConnectionSHP_Points.Location = @"C:\Users\A\Desktop\SDRFiles\SHP\Points";
        pClientConnectionSHP_Points.Mode = 0;
        pClientConnectionSHP_Points.Type = "AV.GDatabase";
        pClientConnectionSHP_Points.Name = "Points SHP Connection";

        pClientConnectionSHP_Points.Connect();

and it gives me the following error "Unable to connect to the database.  Please verify that your warehouse-connection parameters are correct and try again.".

 

 

the location folder (C:\Users\A\Desktop\SDRFiles\SHP\Points) contains the following files:

PointsSHP.dbf

PointsSHP.prj

PointsSHP.shp

PointsSHP.shx

 

Thanks for your help

Technical Evangelist
Posts: 514
Registered: ‎09-11-2015

Re: Unable to connect to a shapefile

Hi Khaled,

 

the Mode property must be zero.

 

Pavel

Frequent Contributor
Posts: 128
Registered: ‎01-14-2018

Re: Unable to connect to a shapefile

Hi Pavel, I tried to change it to zero and the same error appeares, are there any parameter could be set wrongly?

 

Thanks 

Khaled

Highlighted
Technical Evangelist
Posts: 514
Registered: ‎09-11-2015

Re: Unable to connect to a shapefile

Hi Khaled,

 

I cannot see any other problem. Try to double check the path. Also you can query Connection.Database.GErrors collection to see if there is a more detailed error description.

 

Pavel

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.