<P> 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;".</P>
<P> public void GetGeometry(string sqltext)<BR>        {<BR>            try<BR>            {<BR>                Ogr.RegisterAll();<BR>               }<BR>            catch (Exception e)<BR>            { MessageBox.Show("regesiter failor:" + 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("open file failor:" + e.Message);<BR>              }</P>
<P>               }</P>
<P>please help me.</P>
<P>thank you!<BR>                                                                                                     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>)