[gdal-dev] question about ogr

windwxc at sina.com windwxc at sina.com
Sat Apr 19 09:37:51 EDT 2008


 hi,everyone. i meet a question about org. i use VisualStudio2005 with windows XP and i have copy some ogr dll file to bin of my application project.but when i run my project and throw a error, it fails at the first line: Ogr.RegisterAll(). Error is "The type initializer for 'OSGeo.OGR.Ogr' threw an exception."  I find someone meet same question but his method cannot well run and i still cannot find the reason. The following is my codes and i add "using OSGeo.OGR;".
 public void GetGeometry(string sqltext)
        {
            try
            {
                Ogr.RegisterAll();
               }
            catch (Exception e)
            { MessageBox.Show("regesiter failor:" + e.Message); }
            //OSGeo.OGR.Geometry myGeom;
               try
               {
                   OSGeo.OGR.DataSource conn = Ogr.Open("PG:host=locatal dbname=stdb user=stuser password=123", 1);
                   OSGeo.OGR.Layer myLay = conn.ExecuteSQL(sqltext, null, "tt");
                   conn.Dispose();
               }
               catch (Exception e)
               { MessageBox.Show("open file failor:" + e.Message);
              }
               }
please help me.
thank you!
                                                                                                     windsnow

-------------------------------------------------------------------
»ÝÆÕ´º¼¾´ÙÏúËÍ´óÀñ£¬Ö±½µÎåǧÓÅ»ÝÁ¬Á¬( http://d1.sina.com.cn/sina/limeng3/mail_zhuiyu/2008/mail_zhuiyu_20080414.html )

-------------------------------------------------------------------
×¢²áÐÂÀË2GÃâ·ÑÓÊÏ䣨http://mail.sina.com.cn/£©
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080419/7f1a8a15/attachment.html


More information about the gdal-dev mailing list