<P> i am sorry for the trouble brought by my last letter .</P>
<P>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.</P>
<P>my code is:</P>
<P> public void GetGeometry(string sqltext)<BR> {<BR> try<BR> {<BR> Ogr.RegisterAll();<BR> }<BR> catch (Exception e)<BR> { MessageBox.Show( e.Message); }<BR> //OSGeo.OGR.Geometry myGeom;<BR> try<BR> {<BR> OSGeo.OGR.DataSource conn = Ogr.Open("PG:host=locatal dbname=stdb user=stuser password=123", 1);<BR> OSGeo.OGR.Layer myLay = conn.ExecuteSQL(sqltext, null, "tt");<BR> conn.Dispose();<BR> }<BR> catch (Exception e)<BR> { MessageBox.Show( e.Message);<BR> // conn.Dispose();</P>
<P> }<BR> }</P>
<P>my system is windowXP and application programm is VisualStudio.NET 2005 .I use C# .</P>
<P>wish this letter you can read and understand. thank you!</P>
<P> windsnow</P><br />
<br />
-------------------------------------------------------------------<br />
惠普春季促销送大礼,直降五千优惠连连( <a href=http://d1.sina.com.cn/sina/limeng3/mail_zhuiyu/2008/mail_zhuiyu_20080414.html target=_blank>http://d1.sina.com.cn/sina/limeng3/mail_zhuiyu/2008/mail_zhuiyu_20080414.html</a> )<br />
<br />
-------------------------------------------------------------------<br />
注册新浪2G免费邮箱(<a href=http://mail.sina.com.cn/ target=_blank>http://mail.sina.com.cn/</a>)