Windows Phone 7本地数据库的多样化访问,Windows Phone连接数据库

webphp 13年前
     <span style="line-height:21px;border-collapse:collapse;font-family:΢;color:#444444;font-size:14px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;">在Windows Phone 7 Series的设备上有没有本地数据库可以利用?</span><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 没有,在最初的Windows Phone 7 Series上没有本地数据库API可以利用<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;">我应该如何为我的应用程序存储信息? </span><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 你可以将信息存储在自己的存储空间里。如果你需要大型的数据库这里有一些选择:Windows Phone 7 Seires 已经支持WebServices,它可以让你容易的访问存储在Internet上的信息。使用一个可以被WebServices访问的数据库,你的应用程序就可以在连接Internet的情况下实时的获取数据.<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;">以后会支持本地数据库吗? </span><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 当前我们没有宣告这样的计划来增加这一功能;但是我们会密切关注开发人员和用户的需求并识别哪些特性会给每个人带来好处<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 如上翻译过来,更多细节请查看原文.<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 目前WP7已经是Beta版本了. Windows Phone 7 支持访问数据几种方式为: XML、Isolated Storage[SL独立存储]、Cloud[云存储].    官方意思很明确 暂不支持本地数据库访问. 难道我们真的没有其他选择吗?未必如此.<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;">Effiproz For Windows Phone 7</span><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 在上一篇中由Effiproz DataBase来看.NET开源数据库发展我提到Effiproz开源数据库.NET多方面支持,其中就包含WP7.这为我们把Effiproz本地数据库提供访问WP7数据提供了可能.首先说明Effiproz运用在WP7条件:  Windows Phone Developer Tools Beta[最新版本]/VS2010[工具].<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 首先创建一个WP7程序 引入Effiproz数据库DLL[详见源码下载]到项目中<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 创建一个界面用户输入用户名和密码并 保存到Effiproz数据库中<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 数据插入成功后自动查询并实现出来<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 也许有人会注意到两个FileDB和MemoryDB 按钮. 其实对应后台中Effproze数据两种存储数据模式:文件和内存模式. 上篇中我就曾讲到第一个纯.NET版本开源数据库出现问题矛盾就是这两种模式. 内存模式中数据提取直接 速度较快. 免去File模式读取硬盘IO和每次创建Connection的时间. 但是缺点也很致命. 速度虽然有了一定提升 但最终代价是我们数据无法再内存消失后存储. 也就是数据最终无法持久化存储文件中.  EffProze就是从HSQL继承而来. 所以保存这两种模式 供用户更多场景下选择. 先看一下FileDB模式代码实际创建:建:<br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> </span>    <ul style="padding-bottom:0px;margin:0px 0px 0px 14px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" class="litype_1" type="1">     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">private</span></span><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">void</span></span> AddUserInfor_Click(<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">object</span></span> sender, RoutedEventArgs e)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">    {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//用户信息</span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">WP7_LocalDBDemo.DataEntity.Customer newcustomer = <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">new</span></span> DataEntity.Customer</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">{</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">   Username=<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">this</span></span>.username.Text,</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">  Password=<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">this</span></span>.passsword.Text</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">   };</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> dbname = @<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;wp7db.db3&quot;</span>;</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> getreply = <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span>.Empty;<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//回调信息  </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//如果数据库文件不存在 自动创建  </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">Sqlite3.sqlite3 newsqlite = <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">new</span></span> Sqlite3.sqlite3();</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">int</span></span> getres = Sqlite3.sqlite3_open(dbname,<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">ref</span></span> newsqlite);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">if</span></span> (getres == Sqlite3.SQLITE_OK)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">    {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//创建表  </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> sql = @&quot;Create Table Customer</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">                      (</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">                   customername varchar(100),</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">                             customerpass varchar(100)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">                     )  &quot;;</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">Sqlite3.exec(newsqlite, sql, 0, 0, 0);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> insertsql = @<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;insert into Customer Values('&quot;</span>+newcustomer.Username+<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;','&quot;</span>+newcustomer.Password+<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;')&quot;</span>;</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">int</span></span> getinsertres = Sqlite3.exec(newsqlite, insertsql, 0, 0, 0);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">if</span></span> (getinsertres == Sqlite3.SQLITE_OK)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">     {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">            MessageBox.Show(<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;数据插入成功!&quot;</span>);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">      }</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">else</span></span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">    {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">        MessageBox.Show(<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;数据插入失败!&quot;</span>);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">       }</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//自动查询数据   </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> querysql = @<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;select * from Customer&quot;</span>;</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">Sqlite3.dxCallback getcallback = <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">new</span></span> Sqlite3.dxCallback(TakeCallmethod);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">int</span></span> getlocalres=Sqlite3.sqlite3_exec(newsqlite,querysql,getcallback,<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">null</span></span>,<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">ref</span></span> getreply);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">if</span></span> (getlocalres == Sqlite3.SQLITE_OPEN_READWRITE)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">  {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//需要一个执行Reader API?  </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//this.listBox1.Items.Add(getresdd.ToString());   </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">       }</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">        }</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">  }</li>    </ul> EffProze 数据库基本上引入T-SQL大部分关键字支持,基本上合ADO.NET连接数据库方式雷同. 这也让.NET程序员不用再看EffProze新的API痛苦,而通过ADO.NET方式对比即可轻松编码.在代码中连接字符串中connection type=FILE/Memory 每次连接都需要指定采用数据库模式. 这是必须的. Memory模式大同小异不在赘述.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 当有了EffProze数据库在WP7中作一些复杂数据操作. 是否考虑我们我们这样在代码方式太过粗糙原始. 我们需要一个查询工具.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 当然EffPoze官方也为我们考虑到这点. 特意推出一款QueryTool. 当然有多个版本的,你想快速体验可以访问QueryTool in Silverlight 4 liveDemo 把QueryTool利用Silverlight 版本 4来实现. 另外一个版本需要到官方下载 QueryTool 1.2 Version[点击下载]:  提示目前工具支持.NET版本是3.5以上 本地运行:    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 如上提示我们需要打开数据库文件,Effproze数据库文件格式为: [.properties]  编写的SQL脚本对应格式为:[.Script]和SQl那一套完全不同.  下载文件中有实例数据库SamplyDB. 打开:    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 很简单布局,类似SQLSErver. 对T-SQl标准中关键字全面进行高亮支持. 这比SQlite工具要友好. 但我个人使用总体觉得很难受.  用户体验不太好. 其中涉及几个方面:    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> A:对T-Sql标准的有些关键字语法检查太过于严密. 大小写敏感. 写T-Sql出错几率大大增加.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> B:工具功能过于简单. 左边菜单中除了展出和隐藏没有任何对DataBase和表 以及View /Proc的直接操作 只能用T-sql, 这样一来 我们队数据库操作全部靠T-sql 工作量剧增.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> C:最令我不舒服的是 每次出现错误提示太过于简单. 特别大批量T-SQl 无法准确定位错误大概位置 那就更让人望而生畏了.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> D:没有批量数据导入导出. 对于数据插入 没有这样的功能 工作量 真是太令人后怕了.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 所以这个对使用这个工具原则是: 能避免使用就尽量避免使用. 基本上我昨天调试一个对数据库所有存储过程加密 调到最后看到下面始终不变错误提示我先崩溃掉了.真是很杯具啊. 各位也可以适当使用.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 如上是EffProze数据库对WP7数据访问支持一个简单示例以及基本工具使用. 如有疑问请在留言中提出.我会及时回复 ,提供EffProze use In WP7本篇源码下载:    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> /Files/chenkai/EffProzeInWp7Codechenkai.rar    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" />    <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;">SQlite For Windows  Phone 7</span>    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 在本地数据库访问其实我最先尝试SQlite,作为移动平台Android默认数据库大量运用,没有其他原因—只是因为我个人对Sqlite操作很熟. 虽然没有了WP7官方的支持. 但是开源社区力量无线的. 国外有人改写开源Sqlite 3版本使其支持WP7本地数据访问. 我们需要添加一个DLL: Community.CsharpSqlite.WP.dll [源码中]引用.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 创建一个简单页面测试 添加数据后自动查询数据并显示ListBox中:    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 插入数据成功 把插入数据通过自动查询方式显示在ListBox中 添加数据代码:    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" />    <ul style="padding-bottom:0px;margin:0px 0px 0px 14px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" class="litype_1" type="1">     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">private</span></span><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">void</span></span> AddUserInfor_Click(<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">object</span></span> sender, RoutedEventArgs e)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">    {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//用户信息  </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">WP7_LocalDBDemo.DataEntity.Customer newcustomer = <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">new</span></span> DataEntity.Customer</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">           {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">        Username=<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">this</span></span>.username.Text,</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">Password=<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">this</span></span>.passsword.Text</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">     };</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> dbname = @<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;wp7db.db3&quot;</span>;</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> getreply = <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span>.Empty;<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//回调信息  </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//如果数据库文件不存在 自动创建  </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">        Sqlite3.sqlite3 newsqlite = <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">new</span></span> Sqlite3.sqlite3();</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">int</span></span> getres = Sqlite3.sqlite3_open(dbname,<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">ref</span></span> newsqlite);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">if</span></span> (getres == Sqlite3.SQLITE_OK)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">      {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//创建表  </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> sql = @&quot;Create Table Customer</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">        (</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">          customername varchar(100),</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">    customerpass varchar(100)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">                           )  &quot;;</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">         Sqlite3.exec(newsqlite, sql, 0, 0, 0);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> insertsql = @<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;insert into Customer Values('&quot;</span>+newcustomer.Username+<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;','&quot;</span>+newcustomer.Password+<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;')&quot;</span>;</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">int</span></span> getinsertres = Sqlite3.exec(newsqlite, insertsql, 0, 0, 0);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">if</span></span> (getinsertres == Sqlite3.SQLITE_OK)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">          {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">   MessageBox.Show(<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;数据插入成功!&quot;</span>);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">   }</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">else</span></span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">          {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">      MessageBox.Show(<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;数据插入失败!&quot;</span>);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">      }</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//自动查询数据   </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">string</span></span> querysql = @<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#0000ff;padding-top:0px;">&quot;select * from Customer&quot;</span>;</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">Sqlite3.dxCallback getcallback = <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">new</span></span> Sqlite3.dxCallback(TakeCallmethod);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">int</span></span> getlocalres=Sqlite3.sqlite3_exec(newsqlite,querysql,getcallback,<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">null</span></span>,<span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">ref</span></span> getreply);</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;font-weight:700;padding-top:0px;"><span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#006699;padding-top:0px;">if</span></span> (getlocalres == Sqlite3.SQLITE_OPEN_READWRITE)</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">          {</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//需要一个执行Reader API?   </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;"><br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> <span style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;color:#008200;padding-top:0px;">//this.listBox1.Items.Add(getresdd.ToString());  </span></li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">           }</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">        }</li>     <li style="padding-bottom:0px;list-style-type:decimal;margin:0px 0px 0px 2em;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;">    }</li>    </ul> SQlite 3修改后能够支持对WP7数据访问 .大概方式基本同EffProze有些雷同.  但是在实际编码中.Effproze封装API的基本同ADO.NET相似. 这样广大的.NET程序员无需再熟悉EffProze数据库自己API, 而修改SQlite 3支持WP7 不同的是. 这里SQlite 3完全创造自己的一套API. 和原来支持.NET 访问的ADO.NET For SQlite 3  DataProvders完全不同. 没有任何关联.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" /> 那就痛苦了.所以我们需要一个SQlite 3访问WP7 的详细API.  但是很遗憾.如果访问到这份API 需国内或许不能访问.具体地址:Sqlite 3 For Windows Phoen Created API访问地址:  Sqlite 3 For Wp7 API 如有哪位同志KX上网成功 请备份这份API贡献出来吧.    <br style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;word-wrap:break-word;padding-top:0px;" />    <p>SQlite 3支持了WP7的本地数据访问. 但是SQlite 3与EffProze最大特点是Sqlite 3没有数据库链接模式之分[内存/文件模式], 我在做完这个实例后 测试发现. 硬盘上不存在wp7db.db3这个文件. 因此我怀疑修改后SQlite 3版本对数据存储模式应该放到内存中的</p>