Problem when read data from db, .net4 config

Topics: Help
Mar 24, 2011 at 6: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.

Mar 24, 2011 at 8:24 AM

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

Mar 24, 2011 at 9: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.

Mar 24, 2011 at 9:43 AM

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

Mar 24, 2011 at 9:49 AM

Can you see this image ?

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

thanks radioman for helping me.

Mar 24, 2011 at 10:01 AM

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

Mar 24, 2011 at 10: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.

Mar 24, 2011 at 10:14 AM

can you debug it, or just paste debug output?

Mar 24, 2011 at 10:17 AM

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

Mar 24, 2011 at 10:22 AM

an you post your debug output?

Mar 24, 2011 at 10:56 AM

can you see the project ? thanks.

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

Mar 24, 2011 at 3:41 PM

corrupted archive, can't extract ;/

Mar 24, 2011 at 5:48 PM

can you try this link ?

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

Mar 24, 2011 at 6:21 PM

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

Mar 24, 2011 at 7: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
Mar 24, 2011 at 10:44 PM

try this:

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

works fine

Mar 24, 2011 at 10:54 PM

Thanks.

Working Fine.