Problem when read data from db, .net4 config

Topics: Help
Mar 24, 2011 at 5:51 AM

Hi

In my project i want to read images from gmdb databases but give me this error :

The type initializer for 'SingletonCreator' threw an exception.

I export database from demo version but when read from that this error occurs.

My code is here :

 GMap.NET.CacheProviders.MsSQLPureImageCache ch = new GMap.NET.CacheProviders.MsSQLPureImageCache();
                ch.ConnectionString = string.Format("Data Source={0}\\Data.GMDB;Version=3;", Application.StartupPath);
                MainMap.Manager.ImageCacheSecond = ch;
MainMap.Position = new PointLatLng(35.6991287, 51.3384247);
                MainMap.MapType = MapType.GoogleSatellite;
                MainMap.MaxZoom = 17;
                MainMap.MinZoom = 1;
                MainMap.Zoom = 10;

                MainMap.OnMapZoomChanged += new MapZoomChanged(MainMap_OnMapZoomChanged);

 

Thanks for helping me.

Coordinator
Mar 24, 2011 at 7:24 AM

MsSQL is server based database, you need to look at map.CacheLocation instead

Mar 24, 2011 at 8:40 AM

 

Thanks radioman.

 
only MsSQLPureImageCache instead MySQLPureImageCache is in GMap.NET.CacheProviders .
why MySQLPureImageCache not in GMap.NET.CacheProviders?

I want to use Sqlite for Maps tiles and give me that error again with map.CacheLocation.

thanks.

Coordinator
Mar 24, 2011 at 8:43 AM

just set map.CacheLocation and remove everything else, sqlite is by default

Mar 24, 2011 at 8:49 AM

Can you see this image ?

http://20uploads.com/images/1390/farvardin/cf215d57731.jpg

thanks radioman for helping me.

Coordinator
Mar 24, 2011 at 9:01 AM

did you add sqlite dll to your app and set target to x86?

Mar 24, 2011 at 9:08 AM

Yes.

I do this from Documentation and set target to x86 from project properties and Download sqlite dll 64 bit from dlls in codeplex.

Coordinator
Mar 24, 2011 at 9:14 AM

can you debug it, or just paste debug output?

Mar 24, 2011 at 9:17 AM

i can load maps from servers but when use from database and cache gives me that error.

Coordinator
Mar 24, 2011 at 9:22 AM

an you post your debug output?

Mar 24, 2011 at 9:56 AM

can you see the project ? thanks.

http://20uploads.com/files/1390/farvardin/ab38d16ba61.rar

Coordinator
Mar 24, 2011 at 2:41 PM

corrupted archive, can't extract ;/

Mar 24, 2011 at 4:48 PM

can you try this link ?

http://www.4shared.com/file/5TyNnsEB/IslamAtlas2.html

Coordinator
Mar 24, 2011 at 5:21 PM

check Documentation tab again, you need to include specific config when using .net4

Mar 24, 2011 at 6:12 PM

I change app.config to 

<?xml version="1.0"?>
<configuration>
   <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
   </startup>
</configuration>
but that error occurs again
Coordinator
Mar 24, 2011 at 9:44 PM

try this:

MainMap.Manager.Mode = AccessMode.ServerAndCache;
MainMap.CacheLocation = Application.StartupPath + Path.DirectorySeparatorChar;

works fine

Mar 24, 2011 at 9:54 PM

Thanks.

Working Fine.