[gdal-dev] the type initiallizer for'OSGeo.OGR.ogr

windwxc at sina.com windwxc at sina.com
Sat Apr 19 20:43:26 EDT 2008


 i am sorry for the trouble brought by my last letter .
my question is my programm throw a error"the type initiallizer for'OSGeo.OGR.ogr' threw an exception' when it run first line:Ogr.RegisterAll(); but i have add 'using OSGeo.ogr' at the begining of my code.
my code is:
 public void GetGeometry(string sqltext)
        {
            try
            {
                Ogr.RegisterAll();
               }
            catch (Exception e)
            { MessageBox.Show( 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( e.Message);
              // conn.Dispose();
               }
                   }
my system is windowXP and application programm is VisualStudio.NET 2005 .I use C# .
wish this letter you can read and understand. 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/20080420/41f2a0ad/attachment-0001.html


More information about the gdal-dev mailing list