﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-bob-文章分类-powerBuilder</title><link>http://www.blogjava.net/keweibo/category/45104.html</link><description>一专多能  Java,Powerbuilder,Delphi</description><language>zh-cn</language><lastBuildDate>Tue, 28 Sep 2010 19:07:29 GMT</lastBuildDate><pubDate>Tue, 28 Sep 2010 19:07:29 GMT</pubDate><ttl>60</ttl><item><title>Kodigo里面u_sheets显示汉字显示问题</title><link>http://www.blogjava.net/keweibo/articles/331194.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Mon, 06 Sep 2010 06:27:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/331194.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/331194.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/331194.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/331194.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/331194.html</trackback:ping><description><![CDATA[<p><br />
u_sheets控件:</p>
<p>of_drawtabs方法中:<br />
两处uo_paint.Drawtext(aul_hdc, istr_tabs[n].displaytext, lenA(istr_tabs[n].displaytext), istr_tabs[n].textrect, DT_END_ELLIPSIS)<br />
修改为:<br />
uo_paint.Drawtext(aul_hdc, istr_tabs[n].displaytext, -1, istr_tabs[n].textrect, DT_END_ELLIPSIS)</p>
<p>of_updatepoints方法中:</p>
<p>lnv_win32.GetTextExtentPoint32(aul_hdc, istr_tabs[n].displaytext, LEN(istr_tabs[n].displaytext), lstr_size)<br />
修改为:<br />
lnv_win32.GetTextExtentPoint32(aul_hdc, istr_tabs[n].displaytext, LENA(istr_tabs[n].displaytext), lstr_size)</p>
<p>w_tmp_resource中of_gettextwidth方法</p>
<p>lnv_win32.GetTextExtentPoint32(ll_dc, as_text, LEN(as_text), lstr_size)</p>
<p>修改为：</p>
<p>lnv_win32.GetTextExtentPoint32(ll_dc, as_text, LENA(as_text), lstr_size)<br />
<br />
<span style="color: red">轉自:http://blog.csdn.net/gogir/archive/2009/02/07/3867255.aspx</span></p>
<p>&nbsp;</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/331194.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-09-06 14:27 <a href="http://www.blogjava.net/keweibo/articles/331194.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PB 11使用JDBC连接Oracle数据库客户端运行相关异常及解决方法</title><link>http://www.blogjava.net/keweibo/articles/329535.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Sat, 21 Aug 2010 06:32:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/329535.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/329535.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/329535.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/329535.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/329535.html</trackback:ping><description><![CDATA[在开发环境下运行是没有问题的。<br />
不过放在客户端运行时，由于缺少DLL文件和Jar文件报出了不少异常。<br />
<br />
相关异常（只列出一部分）<br />
Could not initialize javaVM <br />
Java Exception : java.lang.NoClassDefFoundError:
com/sybase/powerbuilder/jdbc/PbjdbcSessionEx<br />
Non SQL Error: Could not load class oracle.jdbc.driver.OracleDriver<br />
<br />
将所需的DLL文件（位于%PB_HOME%\Shared\PowerBuilder）COPY到项目文件下<br />
<strong>libjcc.dll<br />
libjutils.dll<br />
pbdpl115.DLL<br />
PBDWE115.DLL<br />
PBJDB115.DLL<br />
PBjvm115.DLL<br />
PBLIB115.DLL<br />
PBODB115.DLL<br />
PBSHR115.DLL<br />
PBVM115.DLL</strong><br />
<br />
将所需的JAR文件复制到%JAVA_HOME%\jre\lib\ext下<br />
如：<br />
<strong>pbjdbc12115.jar（位于%PB_HOME%\Shared\PowerBuilder）<br />
classes12.jar是（位于%ORACLE_HOME%\ora92\jdbc\lib）</strong><br />
<br />
<img src ="http://www.blogjava.net/keweibo/aggbug/329535.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-08-21 14:32 <a href="http://www.blogjava.net/keweibo/articles/329535.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>pb通过jdbc连接oracle</title><link>http://www.blogjava.net/keweibo/articles/328295.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Mon, 09 Aug 2010 03:06:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/328295.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/328295.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/328295.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/328295.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/328295.html</trackback:ping><description><![CDATA[<div class="tit">
pb通过jdbc连接oracle</div>
<div id="blog_text" class="cnt">
<p>工具：pb11.5<br />
数据库：oracle 9<br />
<br />
1、拷贝oracle安装目录 \jdbc\lib 下的classes12.zip到本地目录，这里有oracle的jdbc驱动<br />
<br />
2、运行pb11，打开tools-&gt;system
options，选择java页面，在classpaths里添加刚才粘贴的classes12.zip文件的全路径以及名称，如：d:\mypro
\classes12.zip 。检查jvm status，pb11默认会安装jdk1.5的。<br />
<br />
3、重新启动pb10，注意：在进行了第2步设置后必须重启pb才能使设置生效。<br />
<br />
4、打开tools-&gt;database profiles，选择JDB JDBC，新建jdbc连接。</p>
<p>在connection页面的driver
name里填写oracle.jdbc.driver.OracleDriver&nbsp;&nbsp;&nbsp;  ，</p>
<p>url里填写
jdbc:oracle:thin:@127.0.0.1:1521:DB1&nbsp;&nbsp;&nbsp; <br />
</p>
<p>（127.0.0.1处应为你的数据库所在计算机的ip地址，DB1处应为你的数据库实例名称）<br />
<br />
5、填写login id和password后即可连接。<br />
<br />
6、根据自己需要进行其他设置。</p>
<p> </p>
<p>下面是一个连接语法</p>
<p>SQLCA.DBMS = "JDBC"SQLCA.LogPass = &lt;***&gt;SQLCA.LogId =
"admin"SQLCA.AutoCommit = FalseSQLCA.DBParm =
"Driver=&#8216;oracle.jdbc.driver.oracledriver&#8216;,URL=&#8216;jdbc:oracle:thin:@localhost:1521:dev&#8216;"</p>
</div>
<img src ="http://www.blogjava.net/keweibo/aggbug/328295.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-08-09 11:06 <a href="http://www.blogjava.net/keweibo/articles/328295.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解決退出时,报pfc_closequery_savechanges 错误</title><link>http://www.blogjava.net/keweibo/articles/328147.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Fri, 06 Aug 2010 08:52:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/328147.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/328147.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/328147.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/328147.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/328147.html</trackback:ping><description><![CDATA[現象:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在窗口中加上一个数据窗口 <br />
在运行的时候更改了内容，退出时候不保存 <br />
跳了个框框Predefined &nbsp; Message &nbsp;
"pfc_closequery_savechanges " &nbsp; not &nbsp; found<br />
<br />
解決方法<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 无法连接PFC数据库的错误表 建一个错误表<br />
或者把该服务关掉&nbsp;&nbsp;&nbsp; <strong>gnv_app.of_seterror( false )</strong>
<img src ="http://www.blogjava.net/keweibo/aggbug/328147.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-08-06 16:52 <a href="http://www.blogjava.net/keweibo/articles/328147.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>轉:鼠标单击TabSequence=0的单元格时黑色选中色变为其他颜色 </title><link>http://www.blogjava.net/keweibo/articles/328136.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Fri, 06 Aug 2010 07:53:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/328136.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/328136.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/328136.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/328136.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/328136.html</trackback:ping><description><![CDATA[<h1 class="title_txt">鼠标单击TabSequence=0的单元格时黑色选中色变为其他颜色 <br />
</h1>
原文:http://blog.csdn.net/zm1313/archive/2006/04/04/650402.aspx<br />
<br />
<div class="blogstory">
<script type="text/javascript">
document.body.oncopy = function () {
if (window.clipboardData) {
setTimeout(function () {
var text = clipboardData.getData("text");
if (text && text.length > 300) {
text = text + "\r\n\n本文来自CSDN博客，转载请标明出处：" + location.href;
clipboardData.setData("text", text);
}
}, 100);
}
}
</script>
<script type="text/javascript">						function StorePage() { d = document; t = d.selection ? (d.selection.type != 'None' ? d.selection.createRange().text : '') : (d.getSelection ? d.getSelection() : ''); void (keyit = window.open('http://www.365key.com/storeit.aspx?t=' + escape(d.title) + '&u=' + escape(d.location.href) + '&c=' + escape(t), 'keyit', 'scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes')); keyit.focus(); }</script>
<p><font size="5">&nbsp;</font></p>
<p><font size="5"><img alt="" src="http://blog.csdn.net/images/blog_csdn_net/zm1313/180372/o_o_COLOR.jpg" /></font></p>
<p><font color="#0000ff" size="2"><strong>1、首先将DW属性中的Column Moving
和Mouse Selection 两项取消选中；</strong></font></p>
<p><font color="#0000ff" size="2"><strong>2、在 DW 的Clicked 事件中写代码：</strong></font></p>
<p><font size="2"><strong><font color="#0000ff">&nbsp;&nbsp;&nbsp; //此处声明所用到的相关变量；</font>&nbsp;
</strong></font></p>
<p><font size="2"><strong><font color="#ff0000">&nbsp;&nbsp;&nbsp; long</font>&nbsp; <font color="#0000ff">ll_curcol</font>,<font color="#0000ff">ll_pos,</font><font color="#0000ff">ll_cols</font></strong></font></p>
<p><font size="2"><strong><font color="#ff0000">&nbsp;&nbsp;&nbsp; string</font>&nbsp; <font color="#0000ff">ls_modstring</font>,<font color="#0000ff">ls_colname</font>,<font color="#0000ff">ls_color_1</font>,<font color="#0000ff">ls_color_2</font>,<font color="#0000ff">ls_curcol</font></strong></font></p>
<p><font size="2"><strong><font color="#ff0000">&nbsp;&nbsp;&nbsp; if</font> <font color="#0000ff">row</font> = 0 <font color="#ff0000">then return</font></strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp; <font color="#0000ff">//此处给两个颜色变量赋值；</font>&nbsp;
</strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp; <font color="#0000ff">ls_color_1</font> = <font color="#ff0000">string</font>(<font color="#ff0000">rgb</font>(255,255,255))&nbsp;
</strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp; <font color="#0000ff">ls_color_2</font> = <font color="#ff0000">string</font>(15780518) //此处设置选中单元格为SKY天蓝色</strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp; <font color="#0000ff">//此处获取当前列号和总列数；</font>&nbsp;
</strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp; <font color="#0000ff">//ll_curcol=dw_1.getcolumn()</font></strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">ls_curcol</font> = <font color="#ff0000">left</font>(dw_1.<font color="#ff0000">GetObjectAtPointer</font>(),<font color="#ff0000">pos</font>(dw_1.<font color="#ff0000">GetObjectAtPointer</font>(),"~t")
- 1)</strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp; <font color="#0000ff">ll_cols</font> = <font color="#ff0000">long</font>(dw_1.Object.DataWindow.Column.Count)&nbsp; </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp; <font color="#0000ff">//此处将所有列的BACKGROUND的
MODE属性设为不透明；（注：下面两句其实可以放到FORM的OPEN事件或DW的CONSTRUCTOR里面执行，可以提高效率；）&nbsp; </font></strong></font></p>
<p><font size="2"><strong>dw_1.<font color="#ff0000">setredraw</font>(<font color="#0000ff">false</font>)</strong></font></p>
<p><font size="2"><strong><font color="#ff0000">for</font>&nbsp; <font color="#0000ff">ll_pos</font> = 1&nbsp; <font color="#ff0000">to</font>&nbsp;<font color="#0000ff"> ll_cols</font>&nbsp; </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;<font color="#0000ff"> ls_colname</font> =
dw_1.<font color="#ff0000">Describe</font>("#"+<font color="#ff0000">string</font>(<font color="#0000ff">ll_pos</font>)+".Name")&nbsp; </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp; dw_1.<font color="#ff0000">Modify</font>(<font color="#0000ff">ls_colname</font>+".Background.Mode='0'")&nbsp; </strong></font></p>
<p><font color="#ff0000" size="2"><strong>next&nbsp; </strong></font></p>
<p><font size="2"><strong><font color="#0000ff">&nbsp;&nbsp;
//此处将所操作列的Background.Color属性设为带IF判断的表达式，而除此之外的各列的背景表达式均设为恒值；</font>&nbsp; </strong></font></p>
<p><font size="2"><strong><font color="#ff0000">&nbsp;for</font>&nbsp;<font color="#0000ff"> ll_pos</font> = 1&nbsp;<font color="#ff0000"> to</font>&nbsp; <font color="#0000ff">ll_cols</font>&nbsp; </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;<font color="#0000ff">&nbsp; ls_colname</font> =
dw_1.<font color="#ff0000">Describe</font>("#"+<font color="#ff0000">string</font>(<font color="#0000ff">ll_pos</font>)+".Name")&nbsp; </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">//if&nbsp;
ll_pos&lt;&gt;&nbsp; ll_curcol&nbsp; then</font>&nbsp; </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">if&nbsp;</font> <font color="#0000ff">ls_colname</font> &lt;&gt;<font color="#0000ff">
ls_curcol</font> <font color="#ff0000">then</font></strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff"> ls_modstring</font>
= <font color="#0000ff">ls_colname</font>+".Background.Color='"+<font color="#0000ff">ls_color_1</font>+"'"&nbsp; </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000"> else</font>&nbsp; </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">ls_modstring</font>
= <font color="#0000ff">ls_colname</font>+".Background.Color='"+<font color="#0000ff">ls_color_1</font>+"&nbsp; ~t&nbsp; <font color="#ff0000">if&nbsp;</font>
(<font color="#ff0000">getrow</font>()=<font color="#ff0000">currentrow</font>(),"+<font color="#0000ff">ls_color_2</font>+","+<font color="#0000ff">ls_color_1</font>+")'"&nbsp;
</strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000"> end&nbsp; if&nbsp;</font> </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">//此处执行背景颜色修改；</font>&nbsp;
</strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp;&nbsp;&nbsp; dw_1.<font color="#ff0000">Modify</font>(<font color="#0000ff">ls_modstring</font>)&nbsp;&nbsp;&nbsp; </strong></font></p>
<p><font size="2"><strong>&nbsp;<font color="#ff0000">next&nbsp;</font> </strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp; <font color="#0000ff">//刷新显示新的背景颜色； </font></strong></font></p>
<p><font size="2"><strong>&nbsp;&nbsp; dw_1.<font color="#ff0000">setredraw</font>(<font color="#0000ff">true</font>)</strong></font></p>
</div>
<img src ="http://www.blogjava.net/keweibo/aggbug/328136.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-08-06 15:53 <a href="http://www.blogjava.net/keweibo/articles/328136.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>&lt;转&gt;如何在PB数据窗口中修改数据---设置数据窗口的更新属性 </title><link>http://www.blogjava.net/keweibo/articles/328134.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Fri, 06 Aug 2010 07:36:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/328134.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/328134.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/328134.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/328134.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/328134.html</trackback:ping><description><![CDATA[数据窗口对象非常强大的原因之一就是能够很容易地修改数据库。当用户修改了数据窗口中的数据，插入了新的数据行或者删除了数据行以后，只要调用
update()函数就可以将修改了的数据保存到数据库中。但是，这需要一个前提，就是必须设置数据窗口的修改属性。 <br />
<div id="app-share-content">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
数据窗口要修改数据表，首先清楚数据窗口只能修改一个数据表。当数据窗口的数据来源于不止一个数据表时，可以用脚本控制数据窗口的修改属性来对数据表逐个
进行修改，这种技术在后面有关章节介绍。下面介绍一次修改一个数据表的设定方法。 <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
当数据窗口是用来接受用户的手工录入数据时，应该设置两方面的属性才能确保数据窗口能够用来修改数据表。一个是修改数据窗口的修改属性，另一个是用户可以
修改的字段的相关属性值。 <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  首先介绍数据窗口的修改属性的设置。在数据窗口画板中，使用菜单项Rows-&gt;Update
Properties，弹出如图所示的窗口。
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
数据窗口的所有修改属性都集中在该窗口中。如果数据窗口对应的数据表中定义了主键或者惟一性索引，则数据窗口创建时缺省的就是允许修改，并且正确设置了所
有的修改属性。否则就需要手工进行设置。前面介绍过，当增加、删除或者重新选择了字段时，PowerBuilder将数据窗口的修改属性置为不允许，这时
也应该进行手工设置。 <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  首先应该选中Allow Updates选项，只有选中该选项，才允许继续进行其他属性的设定。在Allow
Updates右面的下拉列表框叫做Table to
Update，只能在该下拉列表框中选择一个，并且必须选择一个数据表名，选中的表就是要被更新的表。 <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  选中了Allow Updates属性后，接下来就要指定在数据窗口中哪些列被更新。在Updateable
Columns列表框中用鼠标单击被更新的字段。当数据窗口中的字段来自不止一个数据表时，这时一定要选择同一个表中的字段，因为一个数据窗口一次只能更
新一个数据表。当数据窗口中增添了字段时，新增添的字段往往是不允许修改的，一定要在该列表框中选择该字段。 <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  选择了可以修改的字段后，就应该在Unique Key
Columns(s)列表框中选择惟一标识一行的列。如果在定义数据表时定义了主键，单击右面的Primary Key按钮可以在该列表框中选中主键。 <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Where Clause for Update/Delete组框中包含了三个选项，用来配置如何在Update和Delete
SQL语句中构造where字句的。这三个选项为数据库加锁提供了三种不同的选择。当某行被选中时，用户可以通过DataWindow对象来提供完整性保
护，可以防止其他用户检索该行。这三个选项是：Key Columns、Key and Updateable Columns和Key and
Modified Columns。下面分别详细介绍。 <br />
<br />
1．Key Columns <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  当开发单用户应用程序或者用户都以加锁方式访问数据库时可以选中该选项。该选项表示数据窗口只使用在Unique Key
Column(s)列表框中指定的惟一列进行数据更新。使用这种方式来修改数据库，并发性很高，不同的用户都可以并发地访问数据库，但是数据的完整性却非
常差。因此要保证数据完整性，只有在单用户应用程序或者加锁访问方式下才使用这种修改方式。 <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
例如，在add_book（通讯录）数据表中定义了5个字段，id为主键，name、address、telephone、ICQ四个字段为可修改字段，
某数据窗口包含这5个字段并且使用Key Columns更新数据库。有如下一条数据： <br />
id：230602710327574 <br />
name：朱义 <br />
address：胜利油田 <br />
telephone：945-8557021 <br />
ICQ：39661314 <br />
假设甲用户修改了这条数据，将name改为&#8220;郭宝利&#8221;，数据窗口产生如下的UPDATE语句： <br />
update add_book <br />
set name = "郭宝利" <br />
where id = "230602710327574"； <br />
其中的where字句中只包含在Unique Key
Columns中指定的字段id，用该字段来确定要修改数据库中哪行数据。该update语句将成功执行。如果乙用户要将address字段修改为&#8220;冀东
油田&#8221;，甲、乙用户同时并发修改id为230602710327574的数据，都会修改成功，但会产生如下的数据： <br />
id：230602710327574 <br />
name：郭宝利 <br />
address：冀东油田 <br />
telephone：945-8557021 <br />
ICQ：39661314 <br />
两个人同时修改了一条记录，本来地址是胜利油田的郭宝利却成了冀东油田的了。 <br />
<br />
2．Key and Updateable Columns <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
这种修改方式是缺省的修改方式，它用主键列和可以修改的列来创建where子句，具有很高的数据完整性，但是并发性却不是太好。推荐使用这种修改方式。 <br />
像上面例子一样，如果甲用户做修改操作，保存数据时将产生如下的SQL语句： <br />
update add_book <br />
set name = "郭宝利" <br />
where id = "230602710327574" <br />
and name = "朱义" <br />
and address = "胜利油田" <br />
and telephone = "945-8557021" <br />
and ICQ = "39661314"； <br />
该SQL语句中的where子句包含了主键id和所有的可修改字段。如果乙用户是在甲保存修改了的数据之前检索的数据，当乙用户要将address修改为
&#8220;冀东油田&#8221;时，产生如下的SQL语句： <br />
update add_book <br />
set address = "冀东油田" <br />
where id = "230602710327574" <br />
and name = "朱义" <br />
and address = "胜利油田" <br />
and telephone = "945-8557021" <br />
and ICQ = "39661314"； <br />
此时，由于甲用户已经修改了数据，将name改成了&#8220;郭宝利&#8221;，所以乙用户的where子句中指定的数据在数据库中已经不存在了，乙的修改不成功，从而保
证了数据的完整性。<br />
<br />
3．Key and Modified Columns <br />
该方法是上面两种方法的折衷，当不同的用户并发修改同一行数据的不同字段时，都能成功修改，所以它的并发性有了一定的限制，数据的完整性比第一种修改方式
有所提高。这种修改方式使用主键和数据发生了变化的列来产生where子句。同样，在上面的例子中，甲用户要将&#8220;朱义&#8221;修改为&#8220;郭宝利&#8221;会产生如下的
SQL语句： <br />
update add_book <br />
set name = "郭宝利" <br />
where id = "230602710327574" <br />
and name = "朱义"； <br />
这时的where子句中只包含主键id和要修改的字段name。如果此时乙用户并发修改数据，要将id为&#8220;230602710327574&#8221;的用户的
address修改为&#8220;冀东油田&#8221;，乙用户也会成功修改。 <br />
<br />
4．时间标记 <br />
如果数据库管理系统支持时间标记，则可以在DataWindow对象的结果集中包含时间标记来获得最大的数据完整性。PowerBuilder将自动为更
新和删除操作的where子句加上时间标记，而不显示在可更新列的列表中。Oracle、SQL
Server完全在服务器上处理时间标记，在DataWindow中不要求有额外的工作。 <br />
<br />
5．Key Modification <br />
该组框用来指定当用户修改了主键时，数据窗口如何来更新数据表中的主键字段。有两种选择，Use Delete then Insert和Use
Update。 <br />
第一个选项是先删除原有主键值，然后再使用新的主键值插入一个完整的行。使用这种更新主键的方式可以减少组织数据的工作量，但在数据库中各个数据表之间存
在父子制约关系，并且依赖该主键的外部键被指定为级联删除时，操作就不会成功的。因为级联删除方式要求当依赖主键的外部键有数据时就不能删除主键。 <br />
当DBMS允许更新主键列时，可以使用该选项，该选项直接修改主键值，所以防止了级联删除带来的操作不成功的问题。 <br />
<br />
6．Identify Column <br />
该下拉列表框用于为下拉列表框中所指定的列（通常是主键列）生成序号，当且仅当DBMS支持序号生成时该作用才有效。 <br />
当正确进行了上述所有操作后，单击OK按钮即完成了修改属性的设置。如果数据窗口允许手工录入数据，接下来就应该设置可修改字段的相关属性了。主要包括如
下属性： <br />
l字段的Tab Order值。 <br />
l字段的Protect属性。 <br />
l字段的DisplayOnly属性。 <br />
l字段的Visible属性。 <br />
上述属性前3个中任意一个都可以让用户无法修改字段中的数据；最后一个属性决定字段是否可见，不可见的字段不管其他属性如何设置，用户都无法修改字段中的
数据。 <br />
首先介绍如何设置字段的Tab Order值。使用菜单项Format-&gt;Tab Order可以在Design窗口显示各字段的当前Tab
Order值，用鼠标单击要修改Tab Order值的字段，然后手工将Tab Order值改为非0即可。在设置Tab Order时要注意三点： <br />
（1）用户可以手工修改的字段，其Tab Order值不能为0。 <br />
（2）在数据窗口修改属性中，不允许修改的字段其Tab Order值应该为0，或者其Display Only属性应该选中。 <br />
（3）Tab Order取值决定字段获得焦点的顺序。在数据窗口中使用Tab按钮在字段间切换时，Tab
Order取值小的首先获得焦点，最大的最后获得焦点。 <br />
字段的Protect属性设置字段是否被保护。如果该属性设置为1，则不允许用户修改字段中的数据，即使Tab
Order设置为非零。字段的DisplayOnly属性决定字段中的内容是否只用来显示，当属性设置为1或者True时，字段中的数据不允许用户修改，
不管其他几个属性是如何设置的。Protect属性只能使用表达式，选中字段后在属性视窗General属性中单击右侧的红色小按钮（如果已经有表达式，
则按钮为绿色），进入到表达式输入对话框，输入该属性的表达式即可。比如，设置用户不能修改字段id原来的数据，可以输入如下的表达式： <br />
if(isRowNew(),0,1) <br />
字段的Display属性在属性视窗Edit中，选中该选项表示该字段中的数据只用来显示，不允许用户修改。该属性不能使用表达式。在PB中，编辑类型的
控件都有该属性，并且属性的作用也是相同的。 <br />
当字段的Tab Order值为0时，肯定不能获得焦点，但是非0时也不一定能获得焦点，还得看字段的Protect属性是否设置为1；当字段的Tab
Order值不为0，Protect属性不为1并且字段的Visible属性为True时，肯定可以获得焦点。DisplayOnly属性和焦点是否能够
获得无关。</p>
</div>
<div id="appShareUrl">
<div id="appShareSafeLinkTip" style="display: none;">为了您的安全，请只打开来
源可靠的网址
<p><a href="http://hi.baidu.com/vcvok/blog/item/9e83db1bbbf526dfad6e75cd.html" target="_blank">打开网站</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://apps.hi.baidu.com/share/detail/5666661#" onclick="share.safelink.close();return false;">取消</a></p>
</div>
来自: <a href="http://hi.baidu.com/vcvok/blog/item/9e83db1bbbf526dfad6e75cd.html" target="_blank">http://hi.baidu.com/vcvok/blog/item/9e83db1bbbf526dfad6e75cd.html</a>
</div>
<img src ="http://www.blogjava.net/keweibo/aggbug/328134.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-08-06 15:36 <a href="http://www.blogjava.net/keweibo/articles/328134.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PFC inv_resize of_Register</title><link>http://www.blogjava.net/keweibo/articles/325897.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Mon, 12 Jul 2010 09:23:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/325897.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/325897.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/325897.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/325897.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/325897.html</trackback:ping><description><![CDATA[<p>this.of_setresize(true) <br />
inv_resize.of_Register(dw_2,inv_resize.SCALErightBOTTOM)&nbsp;&nbsp;
//SCALEbottom&nbsp;&nbsp;  SCALErightBOTTOM</p>
<p>//inv_resize.of_Register(dw_2,inv_resize.FIXEDRIGHTbottom)</p>
<p>在需要使用的窗口中定义一个实例 <br />
n_cst_resize inv_resize; <br />
在open事件中注册窗口上的控件 <br />
inv_resize = create nvo_resize <br />
inv_resize.of_SetOrigSize (this.WorkSpaceWidth(),
this.WorkSpaceHeight()) <br />
inv_resize.of_Register(dw_list, 0, 0, 0, 100) <br />
inv_resize.of_Register(st_hsplitbar, 0, 0, 0, 0) <br />
inv_resize.of_Register(dw_main, 0, 0, 100,0) <br />
inv_resize.of_Register(st_vsplitbar, 0, 0, 0, 0) <br />
inv_resize.of_Register(dw_preview, 0, 0, 100, 100) <br />
//参数: <br />
1.控件对象 <br />
2.移动时的X坐标位移百分数 <br />
3.移动时的Y坐标位移百分数 <br />
4.移动时的WIDTH坐标位移百分数 <br />
5.移动时的HEIGHT坐标位移百分数 <br />
<br />
在resize事件中写入 <br />
inv_resize.Event wfc_Resize (sizetype, This.WorkSpaceWidth(),
This.WorkSpaceHeight()) <br />
在需要使用的窗口中定义一个实例 <br />
n_cst_resize inv_resize; <br />
在open事件中注册窗口上的控件 <br />
inv_resize = create nvo_resize <br />
inv_resize.of_SetOrigSize (this.WorkSpaceWidth(),
this.WorkSpaceHeight()) <br />
inv_resize.of_Register(dw_list, 0, 0, 0, 100) <br />
inv_resize.of_Register(st_hsplitbar, 0, 0, 0, 0) <br />
inv_resize.of_Register(dw_main, 0, 0, 100,0) <br />
inv_resize.of_Register(st_vsplitbar, 0, 0, 0, 0) <br />
inv_resize.of_Register(dw_preview, 0, 0, 100, 100) <br />
//参数: <br />
1.控件对象 <br />
2.移动时的X坐标位移百分数 <br />
3.移动时的Y坐标位移百分数 <br />
4.移动时的WIDTH坐标位移百分数 <br />
5.移动时的HEIGHT坐标位移百分数 <br />
<br />
在resize事件中写入 <br />
inv_resize.Event pfc_Resize (sizetype, This.WorkSpaceWidth(),
This.WorkSpaceHeight())</p>
<p>// Register the controls with the SplitBar <br />
st_v1.of_Register(dw_1, st_v1.left) <br />
st_v1.of_Register(lv_1, st_v1.right)</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/325897.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-07-12 17:23 <a href="http://www.blogjava.net/keweibo/articles/325897.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PFC  autoinstantiate  object</title><link>http://www.blogjava.net/keweibo/articles/325405.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Tue, 06 Jul 2010 14:24:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/325405.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/325405.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/325405.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/325405.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/325405.html</trackback:ping><description><![CDATA[<p align="justify">1 Declare an instance variable of type n_cst_tree:<br />
n_cst_tree inv_tree<br />
Because PFC defines this object with the autoinstantiate option, you don&#8217;t<br />
need to code CREATE or DESTROY statements.</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/325405.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-07-06 22:24 <a href="http://www.blogjava.net/keweibo/articles/325405.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PFC中关于TreeView的用法讲解(转)</title><link>http://www.blogjava.net/keweibo/articles/325182.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Sun, 04 Jul 2010 02:40:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/325182.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/325182.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/325182.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/325182.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/325182.html</trackback:ping><description><![CDATA[<h2>PFC中关于TreeView的用法讲解</h2>
<p><span style="color: red">转自：<a style="color: red" href="http://www.pb9.com.cn/showtopic-190.html">http://www.pb9.com.cn/showtopic-190.html</a></span></p>
<div id="message191" class="t_msgfont">
<div id="ad_thread3_1"></div>
<div id="firstpost">PFC中关于TreeView的用法讲解<br />
<br />
（lily_banana）<br />
<br />
u_tvs<br />
<br />
描述：<br />
基于 TreeView 可视用户对象祖先。该对象采用 数据存储（DataStores）显示TreeView 的数据。<br />
U_tvs 是一个自更新的对象。<br />
对应的库：<br />
PFCMAIN.PBL<br />
PFEMAIN.PBL<br />
对象关系：<br />
Object relationships<br />
&nbsp; &nbsp; PFC 可视用户对象被设计用于从w_master继承来的窗口。U_tvs 也用于：<br />
&nbsp; &nbsp; m_tv<br />
&nbsp; &nbsp; n_cst_infoattrib<br />
&nbsp; &nbsp; n_ds<br />
&nbsp; &nbsp; n_cst_luw<br />
&nbsp; &nbsp; n_cst_tvsrv<br />
&nbsp; &nbsp; n_cst_tvsrv_levelsource<br />
&nbsp; &nbsp; n_cst_print<br />
用法：<br />
在窗口中用该可视用户对象代替PowerBuilder的 TreeView 控件。 U_tvs 事件的脚本可以和PFC的菜单进行集成。<br />
要使用 u_tvs:<br />
1&nbsp; &nbsp; 在窗口中添加一个u_tvs用户对象控件。<br />
2&nbsp; &nbsp; 根据需要使TreeView 的服务可用：<br />
this.of_SetPrint(TRUE)<br />
this.of_SetLevelSource(TRUE)<br />
this.of_SetBase(TRUE)<br />
3&nbsp; &nbsp; 为树的每一层指定数据源：<br />
String&nbsp; ls_sql<br />
Integer&nbsp; li_return<br />
&nbsp; &nbsp; <br />
ls_keys[1] = "dept_id"<br />
&nbsp; &nbsp; this.inv_levelsource.of_Register(1, "dept_name", "", "d_deptlist", SQLCA, "")<br />
&nbsp; &nbsp; &nbsp; ls_keys[1] = "emp_id"<br />
this.inv_levelsource.of_Register(2, "emp_lname", ":parent.1.dept_id",&nbsp; &amp;<br />
&nbsp; &nbsp; &nbsp; "d_empbydept", SQLCA, "")<br />
4&nbsp; &nbsp; 根据需要为树脂定其余的显示信息：<br />
this.inv_levelsource.of_SetPictureColumn(1, "1")<br />
this.inv_levelsource.of_SetSelectedPictureColumn(1,"2")<br />
this.inv_levelsource.of_SetPictureColumn(2, "4")<br />
this.inv_levelsource.of_SetSelectedPictureColumn(2, "5")<br />
<br />
5&nbsp; &nbsp; 检索 TreeView的第一行：<br />
this.event pfc_populate(0)<br />
6&nbsp; &nbsp; 扩展pfc_Retrieve 事件使检索参数生效：<br />
Any&nbsp; la_args[20]<br />
Integer&nbsp; li_level<br />
<br />
IF IsValid(inv_levelsource) THEN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; li_level = this.of_GetNextLevel(al_parent)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.inv_levelsource.of_GetArgs(al_parent, li_level, la_args)<br />
END IF<br />
Return this.of_Retrieve(al_parent, la_args, ads_data)<br />
<br />
7&nbsp; &nbsp; 根据需要调用u_tvs 的其他函数。<br />
要获取关于TreeView 的更多信息，参见《PowerBuilder User's Guide》<br />
<br />
n_cst_tvsrv_print<br />
<br />
描述：<br />
TreeView 打印服务<br />
<br />
对应的库<br />
PFCAPSRV.PBL<br />
PFEAPSRV.PBL<br />
<br />
用法：<br />
<br />
要使用该系统：<br />
<br />
1&nbsp; &nbsp; 调用u_tvs of_SetPrint 函数激活该服务：<br />
tv_1.of_SetPrint(TRUE)<br />
2&nbsp; &nbsp; 调用of_PrintTree 函数来打印 TreeView 数据：<br />
<br />
String&nbsp; ls_levelpicts[10]<br />
String&nbsp; ls_levelselpicts[10]<br />
<br />
ls_levelpicts[1] = "dept.bmp"<br />
ls_levelpicts[2] = "emp.bmp"<br />
ls_levelselpicts[1] = "deptsel.bmp"<br />
ls_levelselpicts[2] = "empsel.bmp"<br />
tv_1.inv_print.of_PrintTree(0, TRUE, ls_levelpicts, ls_levelselpicts)<br />
<br />
of_Register 函数：<br />
&nbsp; 语法1 通过一个DataWindow 对象来显示数据。<br />
描述：<br />
&nbsp; &nbsp; 通过检索DataWindow对象的行来建立TreeView的各级数据层<br />
范围：<br />
Public<br />
语法：<br />
tvcontrol.instancename.of_Register ( level, labelcolumn, retrievespec,&nbsp; &nbsp; dwobject, trans, filterspec )<br />
<br />
参数描述：<br />
tvcontrol&nbsp; &nbsp; &nbsp; &nbsp; u_tvs-based TreeView 控件的实例<br />
instancename&nbsp; &nbsp; n_cst_tvsrv_levelsource的实例 ( u_tvs 的确省值为 inv_levelsource)<br />
level&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Integer 指定TreeView 数据的层次及数据<br />
labelcolumn&nbsp; &nbsp; String 指定u_tvs 用于TreeView项标签的dwobject 的列名。<br />
retrievespec&nbsp; &nbsp; String&nbsp; 包含用于dwobject 检索条件<br />
dwobject&nbsp; &nbsp; &nbsp; &nbsp; String 指定用于数据检索的 DataWindow 对象<br />
trans&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; N_tr 用于检索dwobject的事务对象。如果该参数未指定，则dwobject必须已含有数据。<br />
filterspec&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String 包含需要的过滤条件<br />
<br />
返回值<br />
Integer. 具体如下：<br />
 1&nbsp; 成功<br />
 -1&nbsp; 参数有效性错误<br />
 -2&nbsp; Dwobject 没有指定键列（key columns）<br />
 -3&nbsp; 上一层被标记为循环。<br />
 -4&nbsp; Column level datatype was not in the data source<br />
 -5&nbsp; 为数据源设置事务对象出错<br />
 -7&nbsp; Cache 注册错误<br />
<br />
用法：<br />
&nbsp; &nbsp; TreeViwe的每一层调用该函数一次。<br />
检索参数的格式如下：<br />
:scope.level.column<br />
<br />
where:<br />
<br />
 Scope 指定层（Level）或者父层（Parent）：<br />
 Level&nbsp; 绝对层数<br />
 Parent&nbsp; 和当前层相关的数<br />
<br />
 根据Scope指定的数的性质不同，Level 来制定一个绝对或相对层数。<br />
Scope 指定&nbsp; &nbsp; Level 指定<br />
Level<br />
&nbsp; &nbsp; 你指定的绝对数。例如：:level.1.emp_name 表示检索参数来自于祖先的-1层的emp_name 列<br />
<br />
Parent&nbsp; &nbsp; 你指定的项相对于当前层的值。例如， :parent.2.emp_name 表示检索参数来源于上两层祖先的emp_name 列<br />
<br />
 Column 指定含有用于检索参数值的DataWindow 对象的列名<br />
<br />
<br />
<br />
of_SetPictureColumn 函数：<br />
<br />
描述：<br />
指定未选中时的图标<br />
范围：<br />
Public<br />
语法：<br />
tvcontrol.instancename.of_SetPictureColumn ( level, column )<br />
<br />
参数描述：<br />
tvcontrol&nbsp; &nbsp; &nbsp; &nbsp; u_tvs-based TreeView 控件的实例<br />
instancename&nbsp; &nbsp; n_cst_tvsrv_levelsource的实例 ( u_tvs 的确省值为 inv_levelsource)<br />
level&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Integer 指定被设置图标的层号<br />
column&nbsp; &nbsp; &nbsp; &nbsp; String 指定下述之一：<br />
 u_tvs 用于找到图片的DataWindow 对象的列名，该列可以包括一个文件名或者一个值，指示 u_tvs 来找到 TreeView的图片序列号<br />
 值， 指示 u_tvs 来找到 TreeView的图片序列号<br />
<br />
返回值：<br />
Integer. 1，成功；-1，失败。<br />
<br />
用法：<br />
调用该函数前需要调用of_Register函数 </div>
</div>
<img src ="http://www.blogjava.net/keweibo/aggbug/325182.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-07-04 10:40 <a href="http://www.blogjava.net/keweibo/articles/325182.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PFC的Services （转）</title><link>http://www.blogjava.net/keweibo/articles/325015.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Thu, 01 Jul 2010 13:35:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/325015.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/325015.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/325015.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/325015.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/325015.html</trackback:ping><description><![CDATA[文章来源：<font color="#ff0000">http://www.itfensi.com/exploit/FoxPro/11702662832718_8.html</font><br />
这一章主要介绍了什么是PFC的Services ，以及如何使用它们。 <br />
<br />
　　<strong>一、应用程序服务 </strong><br />
<br />
　　 PFC提供了以下各种应用程序Services ： <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>DataWindow caching <br />
            <br />
            Debugging <br />
            <br />
            Error <br />
            <br />
            Application preference <br />
            <br />
            Most recently uesed object <br />
            <br />
            Security <br />
            <br />
            Transaction registration </td>
        </tr>
    </tbody>
</table>
<br />
　　你必须通过n_cst_appmanager（应用程序管理器）来控制这些 Services （这些Services实际上是应用程序管理器的是数据成员）。应用程序管理器（application manager）通过调用成员函数来开启与关闭Services 。由于它们在应用程序管理器的范围内有效。而应用管理器是全局变量，因此你可以在你的应用程序的任何地方是使用应用程序Services 。 <br />
<br />
　　1. DataWindow caching service <br />
<br />
　　<strong>概要： </strong><br />
<br />
Datawindow caching service为Datawindow提供了数据缓冲。它将数据保存在内存中，从而减少了程序访问数据库的频率，加快了程序的执行速度。 Datawindowcaching service支持如下的数据源： <br />
<br />
　　l_ Datawindow对象，它的数据可以来自于数据库表也可以来自存储过程。 <br />
<br />
　　l_ SQL语句 <br />
<br />
　　l_ Datawindow控件 <br />
<br />
　　l_ DataStore对象 <br />
<br />
　　l_ 数组中的数据 <br />
<br />
　　l_ 文件 <br />
<br />
　　PFC使用Powerbuilder的Datastore来实现Datawindow caching service 。它对的对象是n_cst_dwcache 。 <br />
<br />
　　PFC的代码实际只在父类对象中这本书讲述的都是扩展类的对象，就像 n_cst_dwcache 。而实际上PFC的代码全在父类的对象中（pfc_n_cst_dwcache）。 <br />
<br />
　　使用方法 <br />
<br />
　　使用DataWindow caching 可以将数据库访问频率降到最低，可以加快程序运行速度。 <br />
<br />
　　2 开启DataWindow caching <br />
<br />
　　l_ 调用n_cst_appmanager的of_SetDWCache函数 <br />
<br />
　　gnv_app.of_SetDWCache（TRUE） <br />
<br />
　　(1) 使用Datawindow caching ： <br />
<br />
(1). 调用of_Register函数进行数据缓存，同时依据不同的数据提供相应的参数。 <br />
<br />
　　l_ 缓存Datawindow对象从数据库中检索出的数据时：你需要传递标识符（identifier）、事务对象、Datawindow对象名、其他参数（如果存在的话）。 <br />
<br />
　　l_ 缓存SQL语句从数据库中检索出的数据时：你需要传递标识符（indentifier）、事务对象、SQL语句。 <br />
<br />
　　l_ 将数据缓存到数组中：传递标识符（identifier）、Datawindow对象名、数据。 <br />
<br />
　　l_ 缓存DataWindow控件中的数据：传递标识符（identifier）、Datawindow控件。 <br />
<br />
　　l_ 缓存DataStore中的数据：传递标识符（identifier）、DataStore对象。 <br />
<br />
　　l_ 缓存文件中的数据：传递标识符（identifier）、文件名。 <br />
<br />
　　(2) 你可以使用函数of_IsRegistered（参数是对象本身），确定DataWindow对象是否已经在caching service中注册了。 <br />
<br />
　　(3) 调用函数of_GetRegistered函数访问已经缓存的数据。 <br />
<br />
　　 Gnv_app.inv_dwcache.of_GetRegistered（攄_emplist敚琲ds_datastore） <br />
<br />
　　 Ids_datastore.ShareData（dw_emplist） <br />
<br />
　　(4) 调用函数of_Refresh检索已经缓存数据的DataWindow 。 <br />
<br />
　　(5). 调用函数of_UnRegister函数停止数据缓存服务。 <br />
<br />
　　(6) （可选）调用n_cst_appmanager的of_SetDWCache函数关闭DataWindow cachi ng service 。 <br />
<br />
　　gnv_app.of_SetDWCache（FALSE） <br />
<br />
　　通常你没必要显示的关闭DataWindow caching service 。PFC在删除对象n_cst_dwcache时会自动的关闭它。 <br />
<br />
　　<strong>2. Debugging service </strong><br />
<br />
　　<strong>概要： </strong><br />
<br />
　　Debugging service 在应用程序遇到错误时会自动显示错误信息。PFC的消息路由当发现需要调用的事件不存在时便会使用Debugging service显示出错信息。 <br />
<br />
　　<strong>重要说明：</strong>PFC debugging service 只是一个开发工具。在用户的应用程序中不要开启它。 <br />
<br />
　　<strong>使用方法 </strong><br />
<br />
　　使用debugging service 可以帮助你在PFC的开发过程中解决问题。 <br />
<br />
　　(1) 调用n_cst_appmanager的of_SetDebug函数开启Debugging service 。 <br />
<br />
　　 gnv_app.of_SetDebug（TRUE） <br />
<br />
　　(2) PFC的对象首先检测应用程序的debugging状态，然后在适当的情况下显示错误信息。 <br />
<br />
　　(3) （可选）调用n_cst_appmanager的 of_SetDebug函数关闭Debugging service。 <br />
<br />
　　 gnv_app.of_SetDebug（FALSE） <br />
<br />
　　多数情况下，你不需要显示的关闭Debugging service 。 <br />
<br />
　<strong>3. Application preference service</strong> <br />
<br />
　　<strong>概要：</strong> <br />
<br />
　　你可以利用Application preference service保存、恢复应用程序、用户的信息到INI文件或WINDOWS的<a class="infotextkey" href="http://www.itfensi.com/keyword/regedit.html" target="_blank">注册表</a>中。保存和恢复应用程序设置有如下两个好处： <br />
<br />
　　l_ 延续性：保存应用程序的设置可以使得用户在下次使用软件时可以看到他上次关闭软件的样子。也就是说用户不必每次使用软件时都重新设置他的软件<a class="infotextkey" href="http://doc.itfensi.com/Green" target="_blank">环境</a>。 <br />
<br />
　　l_ 容易维护：你可以无须更改n_cst_appmanager的代码的情况下更新应用程序的设置。 <br />
<br />
　　PFC通过用户自定义对象n_cst_apppreference提供Application preference ser vice 。 <br />
<br />
　　这个Service保存应用程序的如下信息： <br />
<br />
　　用户键（User key） <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>MicroHelp <br />
            <br />
            Help File <br />
            <br />
            Version <br />
            <br />
            Logo bitmap <br />
            <br />
            Copyright notice <br />
            <br />
            DDETimeOut property <br />
            <br />
            DisplayName property <br />
            <br />
            DWMessage Title property <br />
            <br />
            MicrohelpDefault property <br />
            <br />
            RightToLeft property <br />
            <br />
            ToolbarFrameTitle property <br />
            <br />
            ToolbarPopMenuText property <br />
            <br />
            ToolbarSheetTitle property <br />
            <br />
            ToolbarUserControl property <br />
            <br />
            Application preference service 同时保存如下的用户信息 <br />
            <br />
            ToolbarText property <br />
            <br />
            ToolbarTips property <br />
            <br />
            User ID </td>
        </tr>
    </tbody>
</table>
<br />
　　保存、恢复设置 <br />
<br />
　　Application perference service 在应用程序开启的时候会自动恢复应用程序在关闭时保存的设置。这些信息可以保存到<a class="infotextkey" href="http://www.itfensi.com/keyword/regedit.html" target="_blank">注册表</a>中（只限于Windows95和Windows NT）或者INI文件中。你可以按照如下说明： <br />
<br />
　　l_ 保存到<a class="infotextkey" href="http://www.itfensi.com/keyword/regedit.html" target="_blank">注册表</a>中：调用函数of_SetUserKey ，指定你需要保存的键。 <br />
<br />
　　l_ 保存到INI文件中：调用函数of_SetUserINIFile ，指定用于保存信息的INI文件名。 <br />
<br />
　　使用步骤： <br />
<br />
　　(1) 调用n_cst_appmanager的of_SetAppPref函数开启Application preference s ervice 。 <br />
<br />
　　gnv_app.of_SetAppPref（TURE） <br />
<br />
　　(2) 依据不同的执行平台采用不同的方式保存应用程序信息。下面的例子就是在应用程序的构造事件中保存应用程序的信息。同时假设你已经在 n_cst_appmanager中建立好了应用程序信息键、用户信息键、应用程序INI文件、用户INI文件。 <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>IF this.of_IsRegistryAvailable() THEN <br />
            <br />
            this.inv_apppref.of_SetAppKey(this.of_GetAppKey()) this.inv_ <br />
            <br />
            apppref.of_SetUserKey(this.of_GetUserKey()) <br />
            <br />
            ELSE <br />
            <br />
            this.inv_apppref.of_SetAppINIFile(this.of_GetAppINIFile()) this.inv_ap <br />
            <br />
            ppref.of_SetUserINIFile(this.of_GetUserINIFile()) <br />
            <br />
            END IF </td>
        </tr>
    </tbody>
</table>
<br />
　　(3) 调用函数of_SetRestoreApp和of_SetRestoreUser函数设置需要保存信息的类型： <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>this.inv_apppref.of_SetRestoreApp(TRUE) <br />
            <br />
            this.inv_apppref.of_SetRestoreUser(TURE) </td>
        </tr>
    </tbody>
</table>
<br />
　　<strong>4. Most recentily used object service </strong><br />
<br />
　　<strong>概要 </strong><br />
<br />
　　你可以使用Most recentily used object service（最近使用对象Service）将最经使用的对象、表单列在文件菜单下。默认情况下只允许显示5个最经使用对象。 <br />
<br />
　　但是，你可以改变这个数量。 <br />
<br />
　　PFC 通过n_cst_mru用户自定义对象提供MRU Service（Most recentily uesd ob ject service）。 <br />
<br />
　　MRU Service在应用程序启动时会自动的将应用程序关闭时保存的最经使用过的对象信息加载到应用程序中。这些信息可以保存到<a class="infotextkey" href="http://www.itfensi.com/keyword/regedit.html" target="_blank">注册表</a>或者INI文件中。你可以通过如下的方式： <br />
<br />
　　l_ 保存到<a class="infotextkey" href="http://www.itfensi.com/keyword/regedit.html" target="_blank">注册表</a>中：调用函数of_SetUserKey函数确定要保存到<a class="infotextkey" href="http://www.itfensi.com/keyword/regedit.html" target="_blank">注册表</a>中的MRU信息。 <br />
<br />
　　l_ 保存到INI文件中：调用函数of_SetUserINIFile函数指定用于保存MRU信息的INI文件。 <br />
<br />
　　l_ 你必须还要额外编写代码： <br />
<br />
　　为了使用MRU Service ，你必须在你想启用MRU Service的窗口的两个事件中编写代码。 <br />
<br />
　　l_ pfc_MRUProcess ：在窗口开启时加载MRU信息。 <br />
<br />
　　l_ pfc_PreMRUSave ：在窗口关闭时保存MRU信息。 <br />
<br />
　　与PFC菜单的结合 <br />
<br />
　　PFC的 m_master菜单的FILE菜单包括了五个MRU菜单项，你还可以自己添加。 <br />
<br />
　　如果你的应用程序没有使用PFC的菜单，那么请以 m_master为模板建立你自己的M RU菜单项。 <br />
<br />
　　<strong>使用MRU Service步骤</strong> <br />
<br />
　　(1) 调用n_cst_appmanager中的of_SetMRU函数开启MRU Service 。 <br />
<br />
　　 gnv_app.of_SetMRU（TRUE） <br />
<br />
　　(2) 调用n_cst_appmanager的函数of_SetUserKey（尽适用于WIN95与WINNT）或of <br />
<br />
　　 _SetUserINIFile函数（使用于所有的平台）确定需要保留的信息。下面的例子假设你已经为n_cst_appmanager建立好了的用户键（保存到<a class="infotextkey" href="http://www.itfensi.com/keyword/regedit.html" target="_blank">注册表</a>）或者INI文件（保存到INI文件）。下面的代码位于应用程序管理器（n_cst_appmanager）的构造事件。 <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>IF this.of_IsRegistryAvailable() THEN <br />
            <br />
            this.inv_mru.of_SetUserKey(this.of_GetUserKey()) <br />
            <br />
            ELSE <br />
            <br />
            this.inv_mru.of_SetUserINIFile(this.of_GetUserINIFile()) <br />
            <br />
            END IF <br />
            <br />
            (3) Register IDs with the MRU service by calling the n_cst_mru of_Regis <br />
            <br />
            ter function. An ID is the identifier that the window will use to retr <br />
            <br />
            ieve information out of the MRU service. This is an example of code yo <br />
            <br />
            u can add to the pfc_PreOpen event of the MDI frame window: <br />
            <br />
            IF IsValid(gnv_app.inv_mru) THEN gnv_app.inv_mru.of_Register("myapp") <br />
            <br />
            END IF <br />
            <br />
            (4) Extend the pfc_MRUProcess event in each window that uses exclusive <br />
            <br />
            processing, adding code to open the sheet passing the necessary argume <br />
            <br />
            nts (be sure to add similar code to the frame window if you want to sp <br />
            <br />
            ecify exclusive items on the frame menu): <br />
            <br />
            Window lw_frame, lw_window n_cst_menu lnv_menu n_cst_mruattrib lnv_mru <br />
            <br />
            attrib // Check parameters. IF IsNull(ai_row) THEN Return -1 END IF <br />
            <br />
            IF NOT IsValid(gnv_app.inv_mru) THEN Return -1 END IF // Retrieve row <br />
            <br />
            from DataStore. gnv_app.inv_mru.of_GetItem &amp; (ai_row, lnv_mruattri <br />
            <br />
            b) // Get the MDI frame, if necessary. lnv_menu.of_GetMDIFrame(this.me <br />
            <br />
            nuid, lw_frame) OpenSheet(lw_window, &amp; lnv_mruattrib.is_classname, <br />
            <br />
            lw_frame) Return 1 <br />
            <br />
            Performing other actions in the pfc_MRUProcess eventTo see other types <br />
            <br />
            of processing you can perform in the pfc_MRUProcess event, see the co <br />
            <br />
            mments in the pfc_w_master pfc_MRUProcess event.5Extend the pfc_PreMRU <br />
            <br />
            Save event in each window that uses the MRU service. In this event, po <br />
            <br />
            pulate the n_cst_mruattrib object with the id, classname, key, item, a <br />
            <br />
            nd MicroHelp to be saved: <br />
            <br />
            anv_mruattrib.is_id = "myapp" anv_mruattrib.is_classname = this.ClassN <br />
            <br />
            ame() anv_mruattrib.is_menuitemname = this.Title anv_mruattrib.is_menu <br />
            <br />
            itemkey = this.ClassName() anv_mruattrib.is_menuitemmhelp = &amp; "O <br />
            <br />
            pens " + this.Title Return 1 6Extend the pfc_MRURestore event in eac <br />
            <br />
            h window that uses the MRU service. In this event, set the ID of the i <br />
            <br />
            nformation you want to display on the menu: <br />
            <br />
            If IsValid(gnv_app.inv_mru) Then Return gnv_app.inv_mru.of_Restore <br />
            <br />
            ("myapp", This) End If </td>
        </tr>
    </tbody>
</table>
<br />
<strong>5. Error message service </strong><br />
<br />
　　<strong>概要 </strong><br />
<br />
　　Error Message service提供了许多用于显示、纪录应用程序的错误信息。你既可以显示PowerBuilder提供的标准的Message对话框，也可以显示PFC 的W_Message对话框。两种显示效果都具有如下的功能： <br />
<br />
　　l_ 消息日志：将消息纪录到文件中，支持多种平台。PFC会自动的将严重级别大于某个值的消息纪录到文件中。 <br />
<br />
　　l_ 支持MAPI：通过Email发出错误警告。PFC会自动将严重级别大于某个值的消息作为<a class="infotextkey" href="http://www.itfensi.com/soft/tools/emailtools/" target="_blank">邮件</a>发出。 <br />
<br />
　　l_ 消息数据库：通过已经定义好的形式（可以是数据库或文件）来存取消息。定义好了消息格式，使得消息有一种标准的形式、消息的重复减到最少、容易查询。 <br />
<br />
　　l_ 参数替代：消息可以具有参数，这样它会依据程序运行而变化。 <br />
<br />
　　l_ 不显示，直接纪录：消息可以不显示直接纪录到日志中。 <br />
<br />
　　l_ 注释与打印：用户可以打印消息，甚至可以增加注释。对消息日志用于<a class="infotextkey" href="http://www.itfensi.com/soft/tools/emailtools/" target="_blank">邮件</a>时非常有用的。 <br />
<br />
　　l_ 自动关闭：w_message过了数秒后会自动关闭。 <br />
<br />
　　W_message 位图 <br />
<br />
　　如果你使用w_message ，位图在运行时必须有效。 <br />
<br />
　　用法 <br />
<br />
　　Error service可以处理应用程序所有的错误信息。如果你打算将错误信息保存到数据库中，你可以使用PFC.DB中关于消息的几个表，或使用消息管道将它传到你的数据库中。 <br />
<br />
　　使用Messages表 <br />
<br />
　　大多数情况下，你应该将Messages表复制到你的数据库中。这个表已经包含了PFC的错误信息格式。 <br />
<br />
　　使用步骤： <br />
<br />
　　(1) 调用n_cst_appmanager的of_SetError函数开启error message service（创建n_cst_error实例），下面的代码位于n_cst_appmanager的pfc_Open事件： <br />
<br />
　　 this.of_SetError（TRUE） <br />
<br />
　　(2) 定义错误消息的源： <br />
<br />
　　l_ 如果消息源是文件，调用如下函数： <br />
<br />
　　 this.inv_error.of_SetPredefinedSource(揷:/eisapp/eiserr.txt? <br />
<br />
　　l_ 如果消息源是数据库，调用如下函数： <br />
<br />
　　this.inv_error.of_SetPredefinedSource （itr_error） <br />
<br />
　　消息源：当你使用文件作为消息源时，文件中必须包括PFC.DB中Messages表中的所有数据。同时列必须由TAB键隔开。 <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>PFC uses predefined messages in certain situations. If you enable the <br />
            <br />
            error message service and receive message display errors, make sure th <br />
            <br />
            e error message source has been established correctly. Additional user <br />
            <br />
            -defined messages must conform to the format of the messages table (al <br />
            <br />
            so used by the d_definedmessages DataWindow object). </td>
        </tr>
    </tbody>
</table>
<br />
　　l_ （可选）设置日志文件名（调用函数of_SetLogFile参数为空字符串可以不进行日志纪录）： <br />
<br />
　　 this.inv_error.of_SetLogFile（擟:/pb6/errlog.txt敚? <br />
<br />
　　l_ （可选）设置用户ID（用于日志文件）： <br />
<br />
this.inv_error.of_SetUser（this.of_GetUserID（）） <br />
<br />
　　l_ （可选）设置什么类型的消息需要自动纪录： <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>this.inv_error.of_SetNotifySeverity（5） <br />
            <br />
            this.inv_error.of_SetLogSeverity（4） </td>
        </tr>
    </tbody>
</table>
<br />
　　l_ （可选）如果你的应用程序使用了错误自动通告功能。你需要设置当前用户的Email、密码。还可以设置其他的Email用户与密码。下面的例子展示了如何设置Email ID与Password 。 <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>this.inv_error.of_SetNotifyConnection(ims_mailsess) this.inv_error.of <br />
            <br />
            _SetNotifyWho(is_autonotify) </td>
        </tr>
    </tbody>
</table>
<br />
　　说明：以上的代码都可以在n_cst_appmanager的pfc_Open事件中。 <br />
<br />
　　l_ 在应用程序的错误检测中，使用函数of_Message显示对话框。同时你还可以将它纪录到日志中。函数of_Message可以使用数据库中的消息，也可以动态的指定消息。下面的例子就是使用数据库中的消息： <br />
<br />
　　gnv_app.inv_error.of_Message <br />
<br />
　　<strong>使用参数表（只限于已定义的消息） </strong><br />
<br />
　　(1) 在消息表中定义如下的数据。%运行时将被替换： <br />
<br />
　　 EIS1030 Unable to find the file % in % <br />
<br />
　　(2) 定义一个参数数组： <br />
<br />
　　String ls_parms[] <br />
<br />
　　ls_parms[1] = 揕ogfile.txt? <br />
<br />
　　 ls_parm[2] = 揷:/windows/system? <br />
<br />
　　(3) 调用of_Message ，传递参数： <br />
<br />
　　gnv_app.inv_error.of_Message（擡IS1030敚琹s_parms） <br />
<br />
　　PFC在显示消息时使用数组中的第一个元素替换第一个% ，第二元素替换第二个%。<br />
<br />
　<strong>6. Security service </strong><br />
<br />
　　<strong>概要 </strong><br />
<br />
　　PFC的安全机制可以处理许多你的应用程序安全性问题。它包括应用程序管理员组件、安全对象（security object）n_cst_security 。 <br />
<br />
　　用法：在使用Security service时，你必须要定义用户组与用户，然后分别与窗口、菜单、用户对象、控件相关联，然后再编写代码。 <br />
<br />
　　使用步骤： <br />
<br />
　　(1) 定义用户、用户组。参考第七章擯FC Utilities? <br />
<br />
　　为你的窗口控件、菜单、用户对象、其他控件定义安全属性。 <br />
<br />
　　(2) 调用n_cst_appmanager的of_SetSecurity函数创建安全对象this.of_SetSecurity（TRUE） <br />
<br />
　　(3) 为安全对象建立一个事务对象。 <br />
<br />
　　Itr_sec = Create n_tr <br />
<br />
　　Connect using itr_sec； <br />
<br />
　　(4) 调用函数of_InitSecurity初始化安全对象。 <br />
<br />
　　 This.inv_security.of_InitSecurity（itr_sec.擡ISAPP敚琯nv_app.of_GetUserID（） <br />
<br />
　　(5) 以上的代码全部在n_cst_appmanager的pfc_Open事件中编写。 <br />
<br />
　　(6) 应用程序关闭时，断开事务对象的连接、删除事务对象。以下的例子在n_cst _appmanager的pfc_Close事件中。 <br />
<br />
　　Disconnect using itr_sec; <br />
<br />
　　Destroy itr_sec <br />
<br />
　　7. 在你需要使用安全对象的窗口的Open事件或pfc_PreOpen事件中调用函数of_SetSecurity（） <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>IF NOT gnv_app.inv_security.of_SetSecurity(this) THEN <br />
            <br />
            MessageBox("Security","Unable to set security") <br />
            <br />
            Close(this) <br />
            <br />
            End if</td>
        </tr>
    </tbody>
</table>
<br />
　　说明：你可以在其他对象（Datawindow、可视用户对象、菜单，所有你想实现安全机制的对象）。 <br />
<br />
　　<strong>7. Transaction registration service </strong><br />
<br />
　　<strong>概要 </strong><br />
<br />
　　 Transaction registration service可以追踪你的应用程序中的事务对象的使用过程。这个服务只对基于n_tr的对象有效。PFC使用n_cst_trregistration 对象实现Transaction registration service 。 <br />
<br />
　　用法 <br />
<br />
　　当应用程序中使用多个事务对象时，你应该使用Transaction registration service跟踪所有的事务对象。当你的应用程序关闭时，该对象将会自动删除所有已注册的事务对象。使用n_tr的函数 of_SetAutoRollback设置ib_autorollback的值。如果ib_SetAutoRollback的值为False ，则事务对象关闭时将会自动提交。如果ib_SetAutoRollback的值为True ，则事务对象关闭时会自动回滚。 <br />
<br />
　　启动 Transaction registration service <br />
<br />
　　l_ 调用n_cst_appmanager的of_SetTrRegistration函数 gnv_app.of_SetTrRegistration（True）当应用程序关闭时，应用程序会自动删除 Trasaction registration service 。 <br />
<br />
　　<strong>注册事务对象： </strong><br />
<br />
　　l_ 调用n_cst_trregistration的of_Register函数 gnv_app.inv_trregistration.of_Register（SQLCA） 控制当事务对象正处于连接时被删除时的行为l_ 调用n_tr的of_SetAutoRollback函数SQLCA.of_SetAutoRollback（True）如果你设置为True ，同时该对象正处于连接状态，当它被删除时Service会回滚该事务。如果你设置为False ，Service回提交该事务。尽管如此，你应该显示的提交或回滚、断开连接。 <br />
<br />
　　<strong>2 Datawindow服务 </strong><br />
<br />
　　<strong>概要 </strong><br />
<br />
　　大部分的PowerBuilder的应用程序都大量的使用了Datawindow控件。PFC因此提供了功能强大的Datawindow Services 。大部分的Service使用时只需一点代码或者根本不需要编码。PFC的Datawindow Servies实际上都是由一个公共的父类对象（不可视用户自定义对象）继承而来。这个父类对象包括了许多Service的函数、事件、实例变量。同时么每个Datawindow Service还有自己的函数、事件、实例变量。 <br />
<br />
　　访问Datawindow Services <br />
<br />
　　为了使用DataWindow Services，你应该建立基于u_dw的Datawindow对象。U_dw对象包括： <br />
<br />
　　l_ 用于开启、关闭Datawindow Services的函数。 <br />
<br />
　　l_ 用于调用各种Services的函数、事件、实例变量的引用变量。 <br />
<br />
　　l_ 调用Datawindow Service的函数、事件的Precoded事件、用户事件 <br />
<br />
　　l_ 可供你编写代码的空事件在你的应用程序中所有的DataWindow控件都必须是u_dw的子类。 <br />
<br />
　　<strong>开启DataWindow Services</strong> <br />
<br />
　　只开启Datawindow控件需要的Servie ，这样才能将应用程序的负荷将到最小。以下表格列出了所有的Datawindow Service ，以及对应的对象。 <br />
<br />
　　 DataWindow Service 对应的对象<br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>Datawindow service的基类 n_cst_dwsrv <br />
            <br />
            Dropdown search service n_cst_dwsrv_dropdownsearch <br />
            <br />
            Filters service n_cst_dwsrv_filter <br />
            <br />
            Find andreplace service n_cst_dwsrv_find <br />
            <br />
            Linkage service n_cst_dwsrv_linkage <br />
            <br />
            Multitable update service n_cst_dwsrv_multitable <br />
            <br />
            Print preview service n_cst_dwsrv_printpreview <br />
            <br />
            DataWindow property service n_cst_dwsrv_property <br />
            <br />
            Querymode service n_cst_dwsrv_querymode <br />
            <br />
            Reporting service n_cst_dwsrv_report <br />
            <br />
            Required column service n_cst_dwsrv_reqcolumn <br />
            <br />
            DataWindow resize service n_cst_dwsrv_resize <br />
            <br />
            Row management service n_cst_dwsrv_rowmanager <br />
            <br />
            Row selection service n_cst_dwsrv_rowselection <br />
            <br />
            Sort service n_cst_dwsrv_sort </td>
        </tr>
    </tbody>
</table>
<br />
　<strong>8. DataWindow Services 的父类 </strong><br />
<br />
　　<strong>概要 </strong><br />
<br />
　　 DataWindow Services的父类包括了所有DataWindow Services需要的Instance变量、事件、函数。PFC使用n_cst_dwsrv实现DataWindow Services的父类。 <br />
<br />
　　DataStore Service：DataStore Service的对象是n_cst_dssrv <br />
<br />
　　用法 <br />
<br />
　　你可以使用这些Service实现如下功能 <br />
<br />
　　l_ 获取、设置DataWindow信息 <br />
<br />
　　l_ 修改、获取DataWindow脚本函数 <br />
<br />
　　l_ 默认DataWindow service <br />
<br />
　　父类函数在子类中有效 <br />
<br />
　　因为n_cst_dwsrv是所有DataWindow services的父类，因此所有在n_cst_dwsrv的函数在它的子类中都有效。 <br />
<br />
　　开启Basic DataWindow service <br />
<br />
　　l_ 调用u_dw的of_SetBase函数 <br />
<br />
　　 dw_emplist.of_SetBase（TRUE） <br />
<br />
　　当Datawindow被删除时u_dw会自动删除该Service 。 <br />
<br />
　　访问DataWindow <br />
<br />
　　l_ 调用n_cst_dwsrv中的函数 <br />
<br />
　　l_ 定义类型为n_cst_conversion的变量 <br />
<br />
　　n_cst_conversion inv_conversion <br />
<br />
　　因为n_cst_conversion是自动实例化，因此不需要使用Create或者Destroy语句。 <br />
<br />
　　调用转换服务的函数： <br />
<br />
　　l_ 调用函数 <br />
<br />
　　下面的例子假设inv_conversion是实例变量： <br />
<br />
　　 String ls_checked <br />
<br />
　　Ls_checked = inv_conversion.of_String（cbx_confirmed.Enabled） <br />
<br />
　　MessageBox <br />
<br />
　　<strong>7 日期/时间服务 </strong><br />
<br />
　　概要 <br />
<br />
　　PFC的日期/时间提供了许多用于计算日期、时间的函数。例如，你可以使用of_SecondsAfter函数计算两个时间之间的秒数。它对应的对象是n_cst_datatime 。 <br />
<br />
　　对象 n_cst_datatime对象是自动实例化，因此你无须使用Create或Destroy语句。 <br />
<br />
　　使用说明： <br />
<br />
　　你可以使用日期/时间服务进行有关日期/时间的计算。该服务提供了以下函数： <br />
<br />
　　l_ 将Julian日期转换成Gregorian日期 <br />
<br />
　　l_ 将秒数转换成小时 <br />
<br />
　　l_ 将秒数转换成天数 <br />
<br />
　　l_ 将Gregorian日期转换成Julian日期 <br />
<br />
　　l_ 计算两日期之间的年数 <br />
<br />
　　l_ 计算两日期之间的月份 <br />
<br />
　　l_ 计算两日期之间的周数 <br />
<br />
　　l_ 计算两日期之间的秒数 <br />
<br />
　　l_ 计算两日期之间的毫秒 <br />
<br />
　　l_ 判断日期是否有效 <br />
<br />
　　l_ 判断某日是否是平日（非周日）。原文：Determine if a date falls on a weekday <br />
<br />
　　l_ 判断某日是否是周末 <br />
<br />
　　l_ Halt processing until a specified date/time <br />
<br />
　　你可以将n_cst_datetime定义成全局变量、实例变量、局部变量。 <br />
<br />
　　日期/时间函数使用说明 变量类型 <br />
<br />
　　贯穿整个应用程序 全局变量或者n_cst_appmanager的实例变量 <br />
<br />
　　针对一个对象 该对象的实例变量 <br />
<br />
　　针对一段代码 局部变量 <br />
<br />
　　开启日期/时间服务： <br />
<br />
　　l_ 定义类型为n_cst_datetime的变量 <br />
<br />
　　n_cst_datetime inv_datetime <br />
<br />
　　类型n_cst_datetime是自动实例化的，因此无须使用 Create或Destroy语句调用日期/时间服务的函数： <br />
<br />
　　l_ 直接调用函数 <br />
<br />
　　下面的例子假设 inv_datetime是实例变量 <br />
<br />
　　Long ll_seconds,ll_days <br />
<br />
　　Ll_seconds = Long（sle_seconds.Text） <br />
<br />
　　Ll_days = inv_datetime.of_Days（ll_seconds） <br />
<br />
　　MessageBox（擠ate/Time敚琒 tring（ll_seconds）+ ?seconds is equal t <br />
<br />
　　o ?+ String（ll_days） + ?days。摚? <br />
<br />
　<strong>8 文件服务 </strong><br />
<br />
　　<strong>概要</strong> <br />
<br />
　　PFC的文件服务使得你的应用程序可以具备<a class="infotextkey" href="http://www.itfensi.com/soft/filemanage/" target="_blank">文件管理</a>器功能。例如，你可以使用f_FileRename函数改变文件名称。文件服务支持多种<a class="infotextkey" href="http://www.itfensi.com/soft/OS/" target="_blank">操作系统</a>，针对各种<a class="infotextkey" href="http://www.itfensi.com/soft/OS/" target="_blank">操作系统</a>该服务会自动的调用相应的外部函数。它对应的对象是n_cst_filesrv 。 <br />
<br />
　　使用说明： <br />
<br />
　　通过文件服务你可以使用如下操作： <br />
<br />
　　l_ Assembling a concatenated filename 。 <br />
<br />
　　l_ 建立、删除目录。 <br />
<br />
　　l_ 读、写、重命名、复制文件。适用于大于32765字节的文件。 <br />
<br />
　　l_ 访问文件信息，包括日期、时间。 <br />
<br />
　　l_ 在一个目录下创建、排序文件。 <br />
<br />
　　你可以将n_cst_filesrv定义成全局、实例、局部变量。 <br />
<br />
　　使用情况 变量类型 <br />
<br />
　　贯穿整个应用程序 全局变量或者n_cst_appmanager的实例变量针对一个对象 对象的实例变量针对一段代码 局部变量由于PFC会根据特定的平台创建n_cst_filesrv的子类。因此它没有使用PB的自动实例化功能。你必须显示的调用Destroy语句删除该对象。 <br />
<br />
　　开启文件服务： <br />
<br />
　　1. 定义类型为n_cst_filesve的变量 <br />
<br />
　　 n_cst_filesrv inv_filesrv <br />
<br />
　　2. 调用全局函数f_set_filesrv： <br />
<br />
　　 f_SetFilesrv（inv_filesrv,TRUE） <br />
<br />
　　该函数会自动的建立对象inv_filesrv 。 <br />
<br />
　　3. 使用完毕后删除对象 <br />
<br />
　　Destroy inv_filesrv <br />
<br />
　　调用文件服务的函数： <br />
<br />
　　l_ 直接调用函数 <br />
<br />
　　该例子调用函数of_FileRead访问文件信息。该例子假设inv_filesrv是实例变量： <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>Integer li_return <br />
            <br />
            String ls_file[] <br />
            <br />
            li_return = inv_filesrv.of_FileRead(sle_filename.text, ls_file) <br />
            <br />
            CHOOSE CASE li_return <br />
            <br />
            CASE ? <br />
            <br />
            MessageBox("Error", "Error accessing file") <br />
            <br />
            CASE ELSE <br />
            <br />
            // File processing goes here <br />
            <br />
            END CHOOSE </td>
        </tr>
    </tbody>
</table>
<br />
　　删除该服务： <br />
<br />
l_ 使用DESTROY语句 <br />
<br />
DESTROY inv_filesrv <br />
<br />
　　<strong>9 INI文件服务</strong> <br />
<br />
　　<strong>概要 </strong><br />
<br />
　　PFC的INI文件服务提供了许多读、写INI文件的函数。它对应的对象是n_cst_ini file。 <br />
<br />
　　使用说明： <br />
<br />
　　你可以使用INI文件做到如下： <br />
<br />
　　l_ 检索INI文件中的所有键 <br />
<br />
　　l_ 检索INI文件中的所有段 <br />
<br />
　　l_ 删除INI文件中的所有行 <br />
<br />
　　l_ 删除INI文件中一行 <br />
<br />
　　l_ 删除INI文件中一段 <br />
<br />
　　你可以同时使用ProfileInt、ProfileString、 SetProfileString访问INI文件。 <br />
<br />
　　INI文件服务对大小写不敏感。 <br />
<br />
　　开启INI文件服务： <br />
<br />
　　l_ 定义类型为n_cst_inifile的变量： <br />
<br />
　　n_cst_inifile inv_ini_handler <br />
<br />
　　该类型属于自动实例化，因此你无须调用Create与Destroy 。 <br />
<br />
　　使用INI文件服务： <br />
<br />
　　l_ 调用n_cst_inifile的对象函数： <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>String ls_keys[] <br />
            <br />
            Integer li_count, li_size <br />
            <br />
            Li_size = inv_ini_handler.of_GetKeys（gnv_app.of_GetAppINIFile（），? <br />
            <br />
            CustApp s_keys） <br />
            <br />
            Lb_keys.Reset（） <br />
            <br />
            For li_count = 1 to li_size <br />
            <br />
            Lb_keys.AddItem（ls_keys[li_count]） <br />
            <br />
            Next </td>
        </tr>
    </tbody>
</table>
<br />
<strong>10 数字服务 </strong><br />
<br />
　　<strong>概要 </strong><br />
<br />
　　PFC的数字服务提供的函数使得你可以处理二进制数。例如，你可以使用of_GetB it函数判断一位是开还是关。 <br />
<br />
　　使用说明： <br />
<br />
　　你可以使用数字服务中的函数做到： <br />
<br />
　　l_ 判断一位是开还是关 <br />
<br />
　　l_ 将十进制转换成二进制 <br />
<br />
　　l_ 将二进制转换成十进制 <br />
<br />
　　与Window SDK共同使用该对象：Windows SDK中许多函数都使用位返回值。因此你需要使用函数f_GetBit。 <br />
<br />
　　你可以将n_cst_numerical定义成全局、实例、局部变量使用说明 变量类型贯穿整个应用程序 全局变量或者n_cst_appmanager的实例变量针对一个对象 对象的实例的变量针对一段脚本 局部变量开启数字服务： <br />
<br />
　　 l_ 定义类型为n_cst_numerical的变量 <br />
<br />
　　n_cst_numerical inv_numerical <br />
<br />
　　类型n_cst_numerical自动实例化，你无须使用Create或者Destroy语句。 <br />
<br />
　　调用数字服务（numerical service）函数： <br />
<br />
　　l_ 直接调用函数 <br />
<br />
　　下面的例子假设 inv_numerical是实例变量： <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>Long ll_base10 <br />
            <br />
            String ls_binary <br />
            <br />
            Ll_base10 = Long（sle_base10.text） <br />
            <br />
            Ls_binary = inv_numerical.of_Binary（ll_base10） <br />
            <br />
            MessageBox("Numerical", String(ll_base10) + " base 10 is equal to " + <br />
            <br />
            String(ll_base10) + " base 10 is equal to " + ls_binary + " in binary. <br />
            <br />
            ") </td>
        </tr>
    </tbody>
</table>
<br />
　　<strong>11 平台服务 </strong><br />
<br />
　　<strong>概要 </strong><br />
<br />
　　PFC的平台服务提供的函数使到你的应用程序可以使用特定平台的函数。你可以使用该服务实现支持多平台的应用程序，而无须在你的应用程序中加入有关平台检测的代码。例如，你可以调用函数 of_GetFreeMemory确定现在所剩的内存大小。平台服务此时便会依据不同的平台调用相应的外部函数而完成工作。该服务对应的对象是 n_cst_platform以及不同平台的相应的子类。 <br />
<br />
　　打印与页面设置对话框：PFC的平台服务会根据不同的平台作相应的调整。 <br />
<br />
　　使用说明： <br />
<br />
　　平台服务提供的函数有： <br />
<br />
　　l_ 确定可用内存空间 <br />
<br />
　　 l_ 确定可用资源空间 <br />
<br />
　　l_ 确定某一字符串的高度、宽度，单位是PBUs <br />
<br />
　　你可以将 n_cst_platform定义成全局变量、实例变量、局部变量使用说明 变量说明贯穿整个应用程序 全局变量、n_cst_appmanager的实例变量针对一个变量 对象的实例变量针对一段代码 局部变量平台服务没有使用自动实例化功能，因此你必须显示的删除n_cst_platform 。 <br />
<br />
　　在Macintosh上：在 Macintosh上函数of_GetTextSize无法使用。 <br />
<br />
　　开启平台服务： <br />
<br />
　　(1) 定义类型n_cst_platform的变量： <br />
<br />
　　n_cst_platform inv_platform <br />
<br />
　　 (2) 调用f_SetPlatform全局函数 <br />
<br />
　　f_SetPlatform（inv_platform，TRUE） <br />
<br />
　　函数f_SetPlatform会自动建立该对象。 <br />
<br />
　　调用平台服务函数： <br />
<br />
　　l_ 直接调用函数 <br />
<br />
　　下面的例子调用函数of_GetFreememory在状态栏处显示可用内存的大小。 <br />
<br />
<table border="0" cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff">
    <tbody>
        <tr>
            <td>Long ll_free_monery <br />
            <br />
            ll_free_memory = inv_platform.of_GetFreeMemory（） <br />
            <br />
            gnv_app.of_GetFrame（）. SetMicroHelp（擣ree memory：?+ String（ll_ <br />
            <br />
            free_memory））</td>
        </tr>
    </tbody>
</table>
<br />
　　删除服务 <br />
<br />
　　l 调用 Destroy 语句 <br />
<br />
　　Destroy inv_platform <br />
<span style="color: red"><br />
未完。。。</span>
<img src ="http://www.blogjava.net/keweibo/aggbug/325015.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-07-01 21:35 <a href="http://www.blogjava.net/keweibo/articles/325015.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PB 学习笔记</title><link>http://www.blogjava.net/keweibo/articles/324787.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Tue, 29 Jun 2010 08:09:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/324787.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/324787.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/324787.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/324787.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/324787.html</trackback:ping><description><![CDATA[<p>//取得关键字的字段类型<br />
ls_type1 = dw_base.Describe(""+scolumnname+".ColType")<br />
ls_type2 = dw_base.Describe(""+sDispColumn+".ColType")<br />
sdbColumnName=dw_base.Describe(""+scolumnname+".dbName")//关键字的字段名 Modify By GangL 04/12/06 PM 2:17<br />
sdbDispColumn=dw_base.Describe(""+sDispColumn+".dbName")</p>
<p><br />
long ll_found<br />
IF not(isnull(ls_keyword) or ls_keyword = '')&nbsp; then<br />
&nbsp;IF ls_type1 = 'long' THEN<br />
&nbsp;&nbsp;ll_found = dw_base.Find(""+sColumnName+" = "+ls_keyword+"",1,dw_base.RowCount())<br />
&nbsp;ELSE<br />
&nbsp;&nbsp;ll_found = dw_base.Find(""+sColumnName+" = '"+ls_keyword+"'",1,dw_base.RowCount())<br />
&nbsp;END IF<br />
&nbsp;dw_base.ScrollToRow(ll_found)<br />
&nbsp;dw_base.SetRow(ll_found)<br />
&nbsp;sle_1.setfocus()<br />
<br />
</p>
<div id="blog_text" class="cnt">
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">PB</font>数据窗口使用<font face="Times New Roman">SetSqlSelect</font>（）函数应注意的问题<img src="http://img.baidu.com/hi/jx/j_0002.gif"  alt="" /></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">Limitations to using SetSQLSelectUse SetSQLSelect only if the data source for the DataWindow object is a SQL SELECT statement without retrieval arguments and you want PowerBuilder to modify the update information for the DataWindow object:</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">dw_1.Modify("DataWindow.Table.Select='select...'")</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">Modify will not verify the SELECT statement or change the update information, making it faster but more susceptible to user error. Although you can use Modify when arguments are involved, it is not recommended because of the lack of checking.</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal">在脚本中修改数据窗口语法时，如果數據窗口沒有檢索條件，可以使用<font face="Times New Roman">Getsqlselect</font>读取<font face="Times New Roman">sql</font>语句，修改为自己需要的<font face="Times New Roman">sql</font>语句后可用<font face="Times New Roman">Setsqlselect</font>重新设置查询条件；也可以用<font face="Times New Roman">MODIFY</font>（）函数修改，如设置不同的<font face="Times New Roman">where</font>条件，另外设置过后要恢复原来数据窗口的<font face="Times New Roman">sql</font>语句。</p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal">如果有检索条件就不能用<font face="Times New Roman">setsqlselect</font>，</p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal">只可以用<font face="Times New Roman">dw_1.Modify("DataWindow.Table.Select='select...'")</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">Eg</font>：</p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">ls_original=dw_1.getsqlselect()</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">if rb_3.checked=true then //base salary</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls_newsql=ls_original +" and (staff_master.monthly_pay=0 )"</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // fixed salary </font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls_newsql=ls_original +" and (staff_master.monthly_pay in ('1','2','3') )"</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">end if </font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">//int i</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">//i=dw_1.setsqlselect(ls_newsql) //// </font>数据窗口没有设置检索参数可以用<font face="Times New Roman">setsqlselect</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">string ls_tmp</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">//ls_tmp="DataWindow.Table.Select='"+ls_newsql+"'"//// </font>加入的<font face="Times New &#13;&#10;Roman">where</font>条件中用到单引号&#8216;&#8217;这时<font face="Times New Roman">dw_1.Modify("DataWindow.Table.Select='select...'")</font>中的单双引号应互换</p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">ls_tmp='DataWindow.Table.Select="'+ls_newsql+'"' </font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">ls_tmp=dw_1.Modify(ls_tmp) ////</font>有检索参数就只能用<font face="Times New Roman">dw_1.modify()</font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Times New Roman">dw_1.setsqlselect(ls_original)</font></p>
</div>
<img src ="http://www.blogjava.net/keweibo/aggbug/324787.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-06-29 16:09 <a href="http://www.blogjava.net/keweibo/articles/324787.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PB 动态打开窗体，通过字符串指定窗口名称</title><link>http://www.blogjava.net/keweibo/articles/323665.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Wed, 16 Jun 2010 12:08:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/323665.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/323665.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/323665.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/323665.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/323665.html</trackback:ping><description><![CDATA[下面的代码打开四个窗口，其中被打开的窗口名称存放在字符变量中； <br />
你要打开不同的窗口只需要改变字符变量的值就可以了； <br />
<br />
window &nbsp; w_stock_win[ &nbsp; ] <br />
string &nbsp; ls_stock_type[4] <br />
ls_stock_type[1] &nbsp; = &nbsp; "w_stock_wine " <br />
ls_stock_type[2] &nbsp; = &nbsp; "w_stock_scotch " <br />
ls_stock_type[3] &nbsp; = &nbsp; "w_stock_beer " <br />
ls_stock_type[4] &nbsp; = &nbsp; "w_stock_soda " <br />
FOR &nbsp; n &nbsp; = &nbsp; 1 &nbsp; to &nbsp; 4 <br />
&nbsp; &nbsp; //该语句执行后，w_stock_win[n]的窗口从ls_stock_type[n]变量中指定的窗体创建 <br />
&nbsp; &nbsp; Open(w_stock_win[n], &nbsp; ls_stock_type[n]) <br />
NEXT 
<img src ="http://www.blogjava.net/keweibo/aggbug/323665.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-06-16 20:08 <a href="http://www.blogjava.net/keweibo/articles/323665.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PB系统函数 之 日期时间函数</title><link>http://www.blogjava.net/keweibo/articles/323155.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Wed, 09 Jun 2010 06:52:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/323155.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/323155.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/323155.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/323155.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/323155.html</trackback:ping><description><![CDATA[<span style="font-size: 18pt;"><span style="font-size: 36pt;"><span style="font-size: 24pt;"><span style="font-size: 18pt;"><span style="font-size: 14pt;">
<p><span style="font-family: Comic Sans MS; font-size: x-small;">PB系统函数 之
日期时间函数Day()<br />
——————————————————————————-<br />
功能得到日期型数据中的号数(1到31之间的整数值)。<br />
语法Day ( date )<br />
参数date：要得到号数的日期值返回值
Integer。函数执行成功时返回号数(1到31之间的整数值)。如果date参数的值为NULL，则Day()函数返回NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">DayName()<br />
功能得到指定日期是一周中的星期几(例如，Sunday, Monday&#8230;)。<br />
语法DayName ( date )<br />
参数date：date类型值或变量返回值String。函数执行成功时返回指定日期的星期表示(例如，Sunday,
Monday&#8230;)。如果date参数的值为NULL，则DayName()函数返回NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">DayNumber()<br />
功能得到日期型数据是一星期中的第几天(用1到7之间的整数表示，星期天为1，星期一为2，&#8230;)。<br />
语法DayNumber ( date )<br />
参数date：date类型值或变量返回值Integer。函数执行成功时返回指定日期是一星期中的第几天(用1~7表示，星期天为1，星期一为
2，&#8230;)。如果date参数的值为NULL，则DayNumber()函数返回NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">DaysAfter()<br />
功能得到两个日期间的天数。<br />
语法DaysAfter ( date1, date2 )<br />
参数date1：date类型，指定起始日期date2：date类型，指定终止日期返回值Long。函数执行成功时得到两个日期之间的天数。如果
date2的日期在date1的前面，那么DaysAfter()函数返回负值。如果任何参数的值为NULL，则DaysAfter()函数返回
NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">Hour()<br />
功能得到时间值中的小时，采用24小时制。<br />
语法Hour ( time )<br />
参数time：time类型的值返回值Integer。函数执行成功时得到time参数中的小时（00到23之间）。如果time参数的值为NULL，则
Hour()函数返回NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">Minute()<br />
功能得到时间值中的分钟，有效值在00～59之间。<br />
语法Minute ( time )<br />
参数time：time类型的值返回值Integer。函数执行成功时得到time参数中的分钟（00到59之间）。如果time参数的值为NULL，则
Minute()函数返回NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">Month()<br />
功能得到日期值中的月份，有效值在1～12之间。<br />
语法Month ( date )<br />
参数date：date类型的值返回值Integer。函数执行成功时得到date参数中的月份（1到12之间）。如果date参数的值为NULL，则
Month()函数返回NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">Now()<br />
功能得到客户机的当前系统时间，返回值为Time类型。<br />
语法Now()返回值Time。该函数返回客户机的当前系统时间。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">RelativeDate()<br />
功能得到指定日期前多少天或后多少天的日期。<br />
语法RelativeDate(date,n)<br />
参数date：Date类型，指定基准日期n：integer类型，指定天数返回值Date。当n的值大于0时返回参数date指定日期后第n天的日期；
当n的值小于0时返回参数date指定日期前第n天的日期。如果任何参数的值为NULL，则RelativeDate()函数返回NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">RelativeTime()<br />
功能得到指定时间前多少秒或后多少秒的时间，采用24小时制。<br />
语法RelativeTime ( time, n
)参数time：time类型，指定基准时间n：long类型，指定秒数返回值Time。当n的值大于0时返回参数time指定时间后第n秒的时间；当n
的值小于0时返回参数time指定时间前第n秒的时间。如果任何参数的值为NULL，则RelativeTime()函数返回NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">Second()<br />
功能得到时间值中的秒，有效值在00～59之间。<br />
语法Second ( time )<br />
参数time：time类型的值返回值Integer。函数执行成功时得到time参数中的秒（00到59之间）。如果time参数的值为NULL，则
Second()函数返回NULL。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">Today()<br />
功能得到当前系统日期，在某些情况下，同时得到当前系统时间。<br />
语法Today()返回值Date。该函数返回当前系统日期。用法单独调用Today()函数时，该函数总是返回当前系统日期，但是，虽然Today()
函数的返回值类型为Date，在该函数用做某些函数的参数、而该参数要求DateTime类型的值时，Today()函数也能够在返回当前系统日期的同时
返回当前系统时间。再如，Today()函数作为数据窗口控件SetItem()函数的参数，该函数参数中指定的数据窗口列的数据类型为
DateTime，那么当前系统日期和时间将同时设置到数据窗口指定项中。<br />
——————————————————————————&#8211;</span></p>
<p><span style="font-family: Comic Sans MS; font-size: x-small;">Year()<br />
功能得到日期值中的年度(有效取值1000到3000)。<br />
语法Year(date)<br />
参数date：date类型的值返回值Integer。函数执行成功时得到date参数中的年份（采用四位数字），发生错误时返回1900，如果date
参数的值为NULL，则Year()函数返回NULL。用法当应用程序把有两位数字表示年份的字符串转换成日期时，PowerBuilder根据下述规则
选择世纪：如果年份值在00到49之间，PowerBuilder将年份中的世纪（前两位数字）当作20；如果年份值在50到99之
间，PowerBuilder将年份中的世纪（前两位数字）当作19。比如，字符串&#8221;20-10-25&#8243;被PowerBuilder转换为
2020-10-25；字符串&#8221;98-10-25&#8243;被PowerBuilder转换为1998-10-25。因此，如果应用程序中需要指定1950年之前
的日期，应该使用四位数字表示年份，以避免引起歧义。PowerBuilder能够处理的年份从1000到3000之间。</span></p>
</span></span></span></span></span>
<img src ="http://www.blogjava.net/keweibo/aggbug/323155.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-06-09 14:52 <a href="http://www.blogjava.net/keweibo/articles/323155.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PB String ( data, { format } ) </title><link>http://www.blogjava.net/keweibo/articles/323152.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Wed, 09 Jun 2010 06:24:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/323152.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/323152.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/323152.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/323152.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/323152.html</trackback:ping><description><![CDATA[<p style="text-indent: 2em;">函数作用：
该函数有两种用法，一种是进行类型转换，见语法格式二；另一种是进行类型转换的同时还进行数据格式的转换，见语法格式一。重点是格式一的学习和理解。 </p>
<p style="text-indent: 2em;">函数语法： 格式一：String ( data, { format } ) </p>
<p style="text-indent: 2em;">&nbsp; &nbsp;格式二：String ( Blob ) </p>
<p style="text-indent: 2em;">data：要进行类型和格式转换的数据；可以是date、DateTime、数字类型、time或
者string类型。 </p>
<p style="text-indent: 2em;">format：格式串，用来指定参数data的显示格式。
根据参数data的数据类型的不同而不同。当参数data为String类型时，该参数是必需的，否则就没有必要使用该函数了。 </p>
<p style="text-indent: 2em;">返 回 值：
String。函数执行成功时返回以字符串方式表示的指定数据，如果data参数的数据类型与format参数指定的格式不匹配、format参数指定的
格式无效、或data参数不是前面提到的适宜数据类型时，String()函数返回空字符串（""）。 </p>
<p style="text-indent: 2em;">使用说明：format是个用掩码表示的字符串，参数data的类型不同有不同的用法： </p>
<p style="text-indent: 2em;">对data参数为数值类型的情况来说，格式为： </p>
<p style="text-indent: 2em;">正数格式；负数格式；零的显示格式； </p>
<p style="text-indent: 2em;">空的显示格式除第一部分必须提供外，其它部分可以省略。数值型显示格式中使用两个掩码字符：#和0，其中，使用#代表0"9之间的任意数
字，0代表每个零都要显示。另外，货币符号（$或￥）、百分号（%）、小数点（.）、逗号（，）等字符也可以出现在格式字符串中，但是，除小数点（.）、
逗号（，）能够出现在格式字符#和0之间外，其它字符只能放置在格式串的前面或后面，例如，###,###$###是个错误的格式串，
￥###,###,###是个正确的格式串。省略format参数时，String()函数使用PowerBuilder缺省格式。注意，如果显示格式有
多个部分，各部分之间的分号（；）不能省略。其它字符也可以出现在显示格式字符串中（只能放在格式串的开头和末尾），但它们没有特殊意义，系统只是照原样
显示。例如，用显示格式字符串&#8220;收入##&#8221;格式化数值12时，显示结果为&#8220;收入12&#8221;。 </p>
<p style="text-indent: 2em;">对data参数为字符串（String）类型的情况来说，format参数的语法格式为： </p>
<p style="text-indent: 2em;">正常字符串格式；空值时格式 </p>
<p style="text-indent: 2em;">在&#8220;正常字符串格式&#8221;中，@代表字符串中的任意字符，除此之外的任何字符照原样显示，例如，如果定义了下面的格式： </p>
<p style="text-indent: 2em;">&nbsp; &nbsp; （@@）@@@@-@@@@&nbsp;&nbsp;</p>
<p style="text-indent: 2em;">则字符串0166767593显示为：&nbsp;&nbsp;</p>
<p style="text-indent: 2em;">&nbsp; &nbsp;
（01）6676-7593&nbsp;&nbsp;</p>
<p style="text-indent: 2em;">对data参数为日期（Date）类型的情况来
说，format参数的语法格式为： </p>
<p style="text-indent: 2em;">正常日期格式；日期为空值时的格式 </p>
<p style="text-indent: 2em;">日期格式中格式字符意义如下： </p>
<p style="text-indent: 2em;">d -- 开头不带0的日数（如8） </p>
<p style="text-indent: 2em;">dd --
开头带0的日数（如08） </p>
<p style="text-indent: 2em;">ddd -- 星期的英文缩写（如Mon、Tue） </p>
<p style="text-indent: 2em;">dddd -- 星期的英文全称（如Monday、Tuesday） </p>
<p style="text-indent: 2em;">m -- 开头不带0的月份（如8） </p>
<p style="text-indent: 2em;">mm -- 开头带0的月份（如08） </p>
<p style="text-indent: 2em;">mmm --
月份的英文缩写（如Jan、Feb） </p>
<p style="text-indent: 2em;">mmmm --
月份的英文全称（如January、February） </p>
<p style="text-indent: 2em;">yy --
两位数字表示的年份（如97） </p>
<p style="text-indent: 2em;">yyyy --
四位数字表示的年份（如1997） </p>
<p style="text-indent: 2em;">另外，还可以使用下面的关键字作为日期的显示
格式： </p>
<p style="text-indent: 2em;">[General] Windows系统中定义的短日期格式 </p>
<p style="text-indent: 2em;">[LongDate] Windows系统中定义的长日期格式 </p>
<p style="text-indent: 2em;">[ShortDate] Windows系统中定义的短日期格式 </p>
<p style="text-indent: 2em;">对data参数为时间（Time）类型的情况来说，语法格式为： </p>
<p style="text-indent: 2em;">正常时间格式；时间为空值时的格式 </p>
<p style="text-indent: 2em;">时间格式中格式字符意义如下： </p>
<p style="text-indent: 2em;">h --
开头不带0的小时（比如6） </p>
<p style="text-indent: 2em;">hh -- 开头带0的小时（比如06） </p>
<p style="text-indent: 2em;">m -- 开头不带0的分钟（比如6） </p>
<p style="text-indent: 2em;">mm -- 开头带0的分钟（比如06） </p>
<p style="text-indent: 2em;">s -- 开头不带0的秒（比如6） </p>
<p style="text-indent: 2em;">ss -- 开头带0的秒（比如06） </p>
<p style="text-indent: 2em;">f --
开头不带0的微秒，可以指定1"6个f，每个f代表一部分微秒 </p>
<p style="text-indent: 2em;">AM/PM --
用AM/PM显示上、下午时间，12小时制 </p>
<p style="text-indent: 2em;">am/pm --
用am/pm显示上、下午时间，12小时制 </p>
<p style="text-indent: 2em;">A/P --
用A/P显示上、下午时间，12小时制 </p>
<p style="text-indent: 2em;">a/p --
用a/p显示上、下午时间，12小时制 </p>
<p style="text-indent: 2em;">另外，显示格式中还可以使用关键字
[Time]，它表示按当前Windows系统定义的格式显示时间。&nbsp;&nbsp;</p>
<p style="text-indent: 2em;">对
data参数为日期时间（DateTime）类型的情况来说，语法格式为： </p>
<p style="text-indent: 2em;">正常
日期时间格式；日期时间为空值时的格式 </p>
<p style="text-indent: 2em;">日期时间类型使用的掩码就是把日期掩码和
时间掩码结合起来即可。 </p>
<p style="text-indent: 2em;">代码实例： </p>
<p style="text-indent: 2em;">例1、下面的语句将指定日期转换为： Jan 1,1998的格式： </p>
<p style="text-indent: 2em;">string(1998-01-31,&#8221;mmmm dd,yyyy&#8221;) </p>
<p style="text-indent: 2em;">例2、下面的语句把DateTime类型的值转换为：Jan 1,1998 6 hrs and 8
min的字符串： </p>
<p style="text-indent: 2em;">string(DateTime(1998-01-31,06:08:00),&#8217;mmmm
dd,yyyy h &#8220;hrs and&#8221; m &#8221;min&#8221;&#8217;)&nbsp;&nbsp;</p>
<p style="text-indent: 2em;">例3、下面的
语句把string1设置为0123： </p>
<p style="text-indent: 2em;">integer li_num =
123&nbsp;&nbsp;</p>
<p style="text-indent: 2em;">string ls_temp </p>
<p style="text-indent: 2em;">ls_temp = string(li_num,&#8221;0000;(000);****;空&#8221;)&nbsp;&nbsp;</p>
<p style="text-indent: 2em;">例4、下面的语句把string1设置为123： </p>
<p style="text-indent: 2em;">integer li_num = -123 </p>
<p style="text-indent: 2em;">string ls_temp </p>
<p style="text-indent: 2em;">ls_temp = string(li_num,&#8221;000;(000);****;空&#8221;) </p>
<p style="text-indent: 2em;">例5、下面的语句把string1设置为****： </p>
<p style="text-indent: 2em;">integer li_num = 0&nbsp;&nbsp;</p>
<p style="text-indent: 2em;">string ls_temp </p>
<p style="text-indent: 2em;">ls_temp = string(li_num,&#8221;0000;(000);****;空&#8221;) </p>
<p style="text-indent: 2em;">例6、下面的语句把string1设置为空： </p>
<p style="text-indent: 2em;">integer li_num </p>
<p style="text-indent: 2em;">string ls_temp </p>
<p style="text-indent: 2em;">SetNull(li_num) </p>
<p style="text-indent: 2em;">ls_temp =
string(li_num,&#8221;0000;(000);****;空&#8221;)</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/323152.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-06-09 14:24 <a href="http://www.blogjava.net/keweibo/articles/323152.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PB报错: 不能用 DB-Library（如 ISQL）或 ODBC 3.7 或更早版本将 ntext 数据或仅使用 Unicode 排序规则的 Unicode 数据发送到客户端</title><link>http://www.blogjava.net/keweibo/articles/322928.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Sun, 06 Jun 2010 15:19:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/322928.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/322928.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/322928.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/322928.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/322928.html</trackback:ping><description><![CDATA[<p>不能用 DB-Library（如 ISQL）或 ODBC 3.7 或更早版本将 ntext 数据或仅使用 Unicode 排序规则的 Unicode 数据发送到客户端。<br />
<br />
在PB开发过程中，由于数据库中使用了 ntext字段，出现以下提示错误， <br />
PB报错: 不能用 DB-Library（如 ISQL）或 ODBC 3.7 或更早版本将 ntext 数据或仅使用 Unicode 排序规则的 Unicode 数据发送到客户端。</p>
<p>&nbsp;</p>
<p>由于sql server中，ntext和nvarchar字段是用unicode编码存储内容的，因此php通过mssql扩展读取带ntext和nvarchar类型字段的时候会抱错。</p>
<p>如果 title 字段类型为 nvarchar，content 字段类型为 ntext ，那么下面的sql语句会报错：</p>
<p>select title,content from article where 1</p>
<p>正确的写法是：</p>
<p>select convert(varchar(255),title) as title, convert(text,content) as content from article where 1</p>
<p>或者不使用ntext字段</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/322928.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-06-06 23:19 <a href="http://www.blogjava.net/keweibo/articles/322928.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PB ImportFile导入数据</title><link>http://www.blogjava.net/keweibo/articles/322498.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Tue, 01 Jun 2010 14:47:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/322498.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/322498.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/322498.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/322498.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/322498.html</trackback:ping><description><![CDATA[<div class="tit"><span style="color: red">转自：http://hi.baidu.com/zydpc/blog/item/3268273eb8e80ce055e72338.html</span></div>
<table style="table-layout: fixed; width: 100%">
    <tbody>
        <tr>
            <td>
            <div class="cnt" id="blog_text">描述
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Inserts data into a DataWindow control, DataStore object, or graph control from data in a file.</span>一个文件插入数据到一个数据窗口控件，数据存储对象，图形或数据控制。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The data can be tab-separated text, comma-separated text, XML, or dBase format 2 or 3.</span>这些数据可以制表符分隔的文本，以逗号分隔的文本，XML或dBASE格式2或3。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The format of the file depends on whether the target is a DataWindow (or DataStore) or a graph and on the type of graph.</span>该文件的格式取决于该目标是一个数据窗口（或数据存储）或图和图型。</span></p>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">For DataWindow and DataStore syntax, see the <strong>ImportFile</strong> <em>method for DataWindows in the DataWindow Reference or the online Help</em> .</span>对于数据窗口和DataStore的语法，请参阅<em>联机帮助</em> <strong>ImportFile</strong> <em>的方法，在数据窗口DataWindows参考或</em> 。</span></p>
            <h3 class="refhead"><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Applies to</span>适用于</span></h3>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Graph controls in windows and user objects.</span>图控制在窗口和用户对象。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Does not apply to graphs within DataWindow objects, because their data comes directly from the DataWindow.</span>不适用于在数据窗口对象的图形，因为它们的数据直接来自数据窗口。</span></p>
            <h3 class="refhead"><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Syntax</span>句法</span></h3>
            <pre><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>graphname</em> . <strong>ImportFile</strong> ( <em> { importtype}, filename</em> {, <em>startrow</em> {, <em>endrow</em> {, <em>startcolumn</em> } } } )</span> <em><strong>graphname。ImportFile（（importtype），（</strong>文件名，startrow（，endrow（，startcolumn））））</em></span></pre>
            <table cellspacing="0" cellpadding="6" rules="all" summary="column one lists arguments and column two describes them" border="1" frame="void">
                <thead>
                    <tr>
                        <th valign="bottom" scope="col" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Argument</span>论据</span></p>
                        </th>
                        <th valign="bottom" scope="col" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Description</span>描述</span></p>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>graphname</em></span> <em>graphname</em></span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The name of the graph control to which you want to copy data from the specified file.</span>该控件的名称图，您要复制文件数据从指定的。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>importtype</em> (optional)</span> <em>importtype（</em>可选）</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">An enumerated value of the SaveAsType DataWindow constant.</span>一个数据窗口不断枚举值的SaveAsType。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">If this argument is specified, the <em>importtype</em> argument can be specified without an extension.</span>如果该参数指定<em>，importtype</em>参数可以指定不带扩展名。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Valid type arguments for <strong>ImportFile</strong> are:</span>论点<strong>ImportFile</strong>有效的类型有：</span></p>
                        <ul>
                            <li class="fi">
                            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Text!</span>文字！</span></p>
                            <li class="ds">
                            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">CSV!</span> CSV格式！</span></p>
                            <li class="ds">
                            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">XML!</span> XML的！</span></p>
                            <li class="ds">
                            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">DBase2!</span> DBase2！</span></p>
                            <li class="ds">
                            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">DBase3!</span> DBase3！</span></p>
                            </li>
                        </ul>
                        <p>&nbsp;</p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>filename</em></span> <em>文件名</em></span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">A string whose value is the name of the file from which you want to copy data.</span>一个字符串，其值是文件名从你要复制的数据。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The file must be an ASCII, tab-separated file (TXT), comma-separated file (CSV), Extensible ), or dBase format 2 or 3 file (DBF).</span>该文件必须是一个ASCII，制表符分隔的文件（TXT），逗号分隔文件（CSV），可扩展），或2或3的dBase格式文件（DBF的）。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Specify the file's full name.</span>指定文件的全名。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">If the optional <em>importtype</em> is not specified, the name must end in the appropriate extension.</span>如果没有指定可选的<em>importtype，</em>名称必须结束在适当延长。</span></p>
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">If you do not specify <em>filename</em> or if it is <strong>null</strong> , <strong>ImportFile</strong> prompts the user for a file name.</span>如果你不指定<em>文件名</em> ，或者如果它<strong>为null，ImportFile</strong>提示文件的名称为一个用户。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The remaining arguments are ignored.</span>剩余的参数将被忽略。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>startrow</em> (optional)</span> <em>startrow（</em>可选）</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The number of the first detail row in the file that you want to copy.</span>该文件要拷贝数的第一行中的细节。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The default is 1.</span>默认是1。</span></p>
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">For default XML import, if <em>startrow</em> is supplied, the first <em>N</em> ( <em>startrow</em> -1) elements are skipped, where <em>N</em> is the DataWindow row size.</span>对于默认XML导入，如果<em>startrow</em>提供， <em>第</em>一个<em>N（startrow</em> -1）的元素都被跳过， <em>其中</em> N是数据窗口行的大小。</span></p>
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">For template XML import, if <em>startrow</em> is supplied, the first</span>对于XML导入模板，如果<em>startrow</em>提供，首</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">( <em>startrow</em> -1) occurrences of the repetitive row mapping defined in the template are skipped.</span> <em>（startrow</em> -1）发生了重复的行映射模板中定义跳过。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>endrow</em> (optional)</span> <em>endrow（</em>可选）</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The number of the last detail row in the file that you want to copy.</span>该文件要拷贝数的最后细节行中。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The default is the rest of the rows.</span>默认的是该行的其余部分。</span></p>
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">For default XML import, if <em>endrow</em> is supplied, import stops when <em>N</em> * <em>endrow</em> elements have been imported, where <em>N</em> is the DataWindow row size.</span>对于默认XML导入，如果<em>endrow</em>提供，进口停止<em>当</em> N * <em>endrow</em>内容已经进口的， <em>其中</em> N是数据窗口行的大小。</span></p>
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">For template XML import, if <em>endrow</em> is supplied, import stops after <em>endrow</em> occurrences of the repetitive row mapping defined in the template have been imported.</span>对于XML导入模板，如果<em>endrow</em>提供，该模板中定义导入后停止<em>endrow</em>行中出现的重复测绘已导入。</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>startcolumn</em> (optional)</span> <em>startcolumn（</em>可选）</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The number of the first column in the file that you want to copy.</span>匮乏的拷贝数列的第一个文件中的你。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The default is 1.</span>默认是1。</span></p>
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">For default XML import, if <em>startcolumn</em> is supplied, import skips the first ( <em>startcolumn</em> - 1) elements in each row.</span>对于默认XML导入，如果<em>startcolumn</em>提供，进口跳过第一<em>（startcolumn</em> - 1）在每个行元素。</span></p>
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">This argument has no effect on template XML import.</span>这一论点并没有对模板的效果XML导入。</span></p>
                        </td>
                    </tr>
                </tbody>
            </table>
            <h3 class="refhead"><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Returns</span>返回</span></h3>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Long.</span>长。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Returns the number of rows that were imported if it succeeds and one of the following negative integers if an error occurs:</span>返回发生错误的行的数目进口，如果成功，它下面的一个负整数，如果一：</span></p>
            <ul>
                <li class="fi">
                <p><a name="T719"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-1</strong> No rows or <em>startrow</em> value supplied is greater than the number of rows in the file</span> <strong>-1</strong>没有行或<em>startrow</em>值是文件大于供给的数量的行</span></p>
                <li class="ds">
                <p><a name="T720"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-2</strong> Empty file or input data does not match number of columns or required column type</span> <strong>-2</strong>文件为空或输入的数据类型不匹配的列数或要求列</span></p>
                <li class="ds">
                <p><a name="T721"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-3</strong> Invalid argument</span> <strong>-3</strong>无效参数</span></p>
                <li class="ds">
                <p><a name="T722"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-4</strong> Invalid input</span> <strong>-4</strong>输入无效</span></p>
                <li class="ds">
                <p><a name="T723"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-5</strong> Could not open the file</span> <strong>-5</strong>无法打开文件</span></p>
                <li class="ds">
                <p><a name="T724"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-6</strong> Could not close the file</span> <strong>-6</strong>无法关闭文件</span></p>
                <li class="ds">
                <p><a name="T725"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-7</strong> Error reading the text</span> <strong>-7</strong>错误阅读文本</span></p>
                <li class="ds">
                <p><a name="T726"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-8</strong> Unsupported file name suffix (must be *.txt, *.csv, *.dbf or *.xml)</span> <strong>-8</strong>不支持的文件名后缀（必须是*. txt文件，*. CSV格式，*. dbf或*. xml的）</span></p>
                <li class="ds">
                <p><a name="T727"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-10</strong> Unsupported dBase file format (not version 2 or 3)</span> <strong>-10</strong>不受支持的dBASE文件格式（而不是版本2或3）</span></p>
                <li class="ds">
                <p><a name="T728"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-11</strong> XML Parsing Error; XML parser libraries not found or XML not well formed</span> <strong>-11</strong> XML解析错误; XML解析器库不存在或没有很好形成的XML</span></p>
                <li class="ds">
                <p><a name="T729"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>-12</strong> XML Template does not exist or does not match the DataWindow</span> <strong>-12</strong> XML模板不存在或不匹配的数据窗口</span></p>
                </li>
            </ul>
            <p>&nbsp;</p>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">If any argument's value is <strong>null</strong> , <strong>ImportFile</strong> returns <strong>null</strong> . If the optional <em>importtype</em> argument is specified and is not a valid type, <strong>ImportFile</strong> returns -3.</span>如果任何参数的值<strong>是</strong> null， <strong>返回</strong> null <strong>ImportFile。</strong>如果可选<em>importtype</em>参数指定，而不是一个有效的类型<strong>，ImportFile</strong>返回-3。</span></p>
            <h3 class="refhead"><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Usage</span>用法</span></h3>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The format of the file can be indicated by specifying the optional <em>importtype</em> parameter, or by including the appropriate file extension.</span>该文件的格式，可通过指定可选的显示<em>importtype</em>参数，或通过包括适当的文件扩展名。</span></p>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">For graph controls, <strong>ImportFile</strong> only uses three columns and ignores other columns.</span>对于图形控制<strong>，ImportFile</strong>只使用3列，而忽略其他列。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Each row of data must contain three pieces of information.</span>每个数据行中必须包含三个信息件。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The information depends on the type of graph:</span>该信息取决于图表类型：</span></p>
            <ul>
                <li class="fi">
                <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">For all graph types except scatter, the first column to be imported is the series name, the second column contains the category, and the third column contains the data.</span>对于所有类型，除了散布图，第一列从外地输入的是该系列的名称，第二列包含类，第三列包含的数据。</span></p>
                <li class="ds">
                <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">For scatter graphs, the first column to be imported is the series name, the second column is the data's x value, and the third column is the y value.</span>对于散布图，第一列从外地输入的是该系列的名称，第二列是数据的x值，第三列是y值。</span></p>
                </li>
            </ul>
            <p>&nbsp;</p>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">You can add data to more than one series by specifying different series names in the first column.</span>您可以添加数据到多个系列的第一列指定不同的系列名称研究。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">To let users select the file to import, specify a <strong>null</strong> string for <em>filename</em> . PowerBuilder displays the Select Import File dialog box.</span>为了让用户选择要导入的文件， <em>文件名</em>指定一个<strong>空</strong>字符串。PowerBuilder中显示选择导入文件对话框。</span></p>
            <p><a name="T730"></a><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong>Double quotes</strong> The location and number of double quote marks in a field in a tab delimited file affect how they are handled when the file is imported.</span> <strong>双引号</strong>双数场引号中的位置和一个制表符分隔的文件影响到他们如何处理时，该文件是进口的。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">If a string is enclosed in one pair of double quotes, the quotes are discarded.</span>如果字符串被双引号括在一对的报价将被丢弃。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">If it is enclosed in three pairs of double quotes, one pair is retained when the string is imported.</span>如果是双引号括在三对，一对是保留字符串时是进口的。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">If the string is enclosed in two pairs of double quotes, the first pair is considered to enclose a null string, and the rest of the string is discarded.</span>如果字符串引号括在双两对，第一对被认为是一个空字符串括起来，而其余的字符串将被丢弃。</span></p>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">When there is a double quote at the beginning of a string, any characters after the second double quote are discarded.</span>当有一个双引号的字符串开始时，双引号的所有字符后，第二次将被丢弃。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">If there is no second double quote, the tab character delimiting the fields is not recognized as a field separator and all characters up to the next occurrence of a double quote, including a carriage return, are considered to be part of the string.</span>如果没有第二个引号，制表符分隔的返回字段是不承认所有作为字段分隔符和字组成的一个运输的下一个出现的一个双引号，包括被认为是字符串的一部分。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">A validation error is generated if the combined strings exceed the length of the first string.</span>验证错误，如果合并生成字符串的字符串长度超过了第一。</span></p>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Double quotes after the first character in the string are rendered literally.</span>双引号字符的字符串字面呈现后的第一次。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Here are some examples of how tab-delimited strings are imported into a two-column DataWindow:</span>这里有一些例子，说明制表符分隔的字符串被导入到一个两列的数据窗口：</span></p>
            <table cellspacing="0" cellpadding="6" rules="all" summary="column one shows sample text strings and column two shows the result of importing the strings into a two column Data Window" border="1" frame="void">
                <thead>
                    <tr>
                        <th valign="bottom" scope="col" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Text in file</span>文本文件</span></p>
                        </th>
                        <th valign="bottom" scope="col" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Result</span>结果</span></p>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">"Joe" TAB "Donaldson"</span> &#8220;乔&#8221;统计表&#8220;唐纳森&#8221;</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Joe Donaldson</span>乔唐纳森</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Bernice TAB """Ramakrishnan"""</span>伯尼斯统计表&#8220;&#8221;&#8220;莱玛克里斯南&#8221;&#8220;&#8221;</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Bernice "Ramakrishnan"</span>伯尼斯&#8220;莱玛克里斯南&#8221;</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">""Mary"" TAB ""Li""</span> &#8220;&#8221;玛丽&#8220;&#8221;标签&#8220;，&#8221;礼&#8220;&#8221;</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Empty cells</span>空细胞</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">"Mich"ael TAB """Lopes"""</span> &#8220;迈克&#8221;机场快线统计表&#8220;&#8221;&#8220;洛佩斯&#8221;&#8220;&#8221;</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Mich "Lopes"</span>迈克&#8220;洛佩斯&#8221;</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">"Amy TAB Doherty"</span> &#8220;艾米统计表多尔蒂&#8221;</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Amy&lt;TAB&gt;Doherty in first cell, second cell empty</span>艾米&lt;Tab&gt;键多尔蒂在第一个单元格，第二个单元格为空</span></p>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">3""" TAB 4"</span> 3&#8220;&#8221;&#8220;标签4&#8221;</span></p>
                        </td>
                        <td valign="top" align="left">
                        <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">3""" 4"</span> 3&#8220;&#8221;&#8220;4&#8221;</span></p>
                        </td>
                    </tr>
                </tbody>
            </table>
            <div class="note">
            <p><img height="17" alt="注意" src="http://infocenter.sybase.com/help/topic/com.sybase.dc37781_1100/html/psref_merged/note.gif" width="17" align="bottom" border="0" /><a name="T731"></a> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><strong class="note_title"><font color="#000091">Specifying a <strong>null</strong> string for file name</font></strong> If you specify a <strong>null</strong> string for <em>filename</em> , the remaining arguments are ignored.</span> <strong class="note_title"><font color="#000091">指定一个文件名称为<strong>空</strong>字符串</font></strong> ，如果你指定一个<strong>空</strong>字符串为<em>文件名</em> ，其余的参数被忽略。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">All the rows and columns in the file are imported.</span>文件的所有行和列的都是进口的。</span></p>
            </div>
            <h3 class="refhead"><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Examples</span>范例</span></h3>
            <h4 class="refname"><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>Example 1</em></span> <em>示例1</em></span></h4>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">This statement copies all the data in the file <em>D:\EMPLOYEE.TXT</em> to <em>gr_employee</em> starting at the first row:</span>本声明中的所有数据复制的<em>文件D：\ EMPLOYEE.TXT</em>以<em>gr_employee</em>行开始在第一：</span></p>
            <pre><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">gr_employee. <em>ImportFile</em> ("D:\EMPLOYEE.TXT")</span> <em>gr_employee。ImportFile（</em>的&#8220;D：\ EMPLOYEE.TXT&#8221;）</span></pre>
            <p>&nbsp;</p>
            <h4 class="refname"><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>Example 2</em></span> <em>例2</em></span></h4>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">This statement copies the data from the file <em>D:\EMPLOYEE.TXT</em> starting with row 2 column 3 and ending with row 30 column 5 to the graph <em>gr_employee</em> :</span>本声明的副本<em>文件</em> D中的数据来自<em>：\ EMPLOYEE.TXT</em>开始，第2行第3列和行结尾的5至30列图<em>gr_employee：</em></span></p>
            <pre><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">gr_employee. <em>ImportFile</em> ("D:\EMPLOYEE.TXT", 2, 30, 3)</span> <em>gr_employee。ImportFile（</em>的&#8220;D：\ EMPLOYEE.TXT&#8221;，2，30，3）</span></pre>
            <p>&nbsp;</p>
            <h4 class="refname"><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>Example 3</em></span> <em>例3</em></span></h4>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The following statements are equivalent.</span>下面的语句是等价的。</span> <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Both import the contents of the XML file named <em>myxmldata</em> :</span>这两种导入XML文件的内容命名<em>myxmldata：</em></span></p>
            <pre><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">gr_control.ImportFile(myxmldata.xml)</span> gr_control.ImportFile（myxmldata.xml）</span>
            <span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">gr_control.ImportFile(XML!, myxmldata)</span> gr_control.ImportFile（XML的！，myxmldata）</span></pre>
            <p>&nbsp;</p>
            <h4 class="refname"><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left"><em>Example 4</em></span> <em>范例4</em></span></h4>
            <p><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">This example causes PowerBuilder to display the Specify Import File dialog box:</span>这个例子使PowerBuilder中显示指定文件导入对话框：</span></p>
            <pre><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">string null_str</span>字符串null_str</span></pre>
            <p>&nbsp;</p>
            <pre><span onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">SetNull(null_str)</span> SetNull（null_str）</span></pre>
            <p>&nbsp;</p>
            <pre><span style="background-color: #e6ecf9" onxxxxxxxxx="_tipon(this)" onxxxxxxxx="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">dw_main. <em>ImportFile</em> (null_str)</span> <em>dw_main。ImportFile（null_str）</em></span></pre>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<img src ="http://www.blogjava.net/keweibo/aggbug/322498.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-06-01 22:47 <a href="http://www.blogjava.net/keweibo/articles/322498.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DataWindow.Processing 判断 DataWindow 对象的类型</title><link>http://www.blogjava.net/keweibo/articles/322457.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Tue, 01 Jun 2010 08:08:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/322457.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/322457.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/322457.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/322457.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/322457.html</trackback:ping><description><![CDATA[<div id="blog_text" class="cnt">
<p>可用 DataWindow.Processing 判断
DataWindow 对象的类型，dw的类型如下：<br />
&nbsp;&nbsp;&nbsp;  0  (Default) Form, group, query, or tabular <br />
&nbsp;&nbsp;&nbsp;  1  Grid <br />
&nbsp;&nbsp;&nbsp;  2  Label <br />
&nbsp;&nbsp;&nbsp;  3  Graph <br />
&nbsp;&nbsp;&nbsp;  4  Crosstab <br />
&nbsp;&nbsp;&nbsp;  5  Composite <br />
&nbsp;&nbsp;&nbsp;  7  RichText</p>
<p>示例一：<br />
This.Object.Datawindow.Processing = '0'</p>
<p>示例二：<br />
String&nbsp;&nbsp;&nbsp;  ls_processing</p>
<p>ls_processing = idw_requestor.Describe("datawindow.Processing")<br />
If ls_processing = "4" Then<br />
&nbsp;&nbsp;&nbsp;  idw_requestor.Modify("DataWindow.Crosstab.StaticMode=Yes")<br />
End If</p>
</div>
<img src ="http://www.blogjava.net/keweibo/aggbug/322457.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-06-01 16:08 <a href="http://www.blogjava.net/keweibo/articles/322457.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PB变量的作用域</title><link>http://www.blogjava.net/keweibo/articles/321706.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Mon, 24 May 2010 02:25:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/321706.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/321706.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/321706.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/321706.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/321706.html</trackback:ping><description><![CDATA[<p><strong><font color="#ff00ff" face="宋体" size="4">变量的作用域</font></strong></p>
<p><strong><font color="#000080" face="宋体" size="4">&nbsp;
作用域定义变量在什么范围内有效。PowerBuilder的变量作用域共有四种：全局变量、实例变量、共享变量和局部变量。不同作用域的变量需要在不同
的位置说明，下面分别予以介绍。在编程窗口、窗口画笔、用户对象画笔或菜单画笔中，选择&#8220;Declare&#8221;菜单中的&#8220;Global
Variables<span lang="zh-cn">&#8221;、</span>&#8220;Instance Variables<span lang="zh-cn">&#8221;</span></font></strong><span lang="zh-cn"><strong><font color="#000080" face="宋体" size="4">和</font></strong></span><strong><font color="#000080" face="宋体" size="4">&#8220;Shared
Variables<span lang="zh-cn">&#8221;可以分别声明全局、实例和共享这三类变量。</span></font></strong></p>
<p><strong><font color="#800000" face="宋体" size="4">全局变量</font></strong></p>
<p><strong><font color="#000080" face="宋体" size="4">&nbsp;
全局变量在整个应用程序中都可访问，它的作用域是整个应用程序
<span lang="zh-cn">。</span></font></strong></p>
<p><span lang="zh-cn"><strong><font color="#800000" face="宋体" size="4">实例变量</font></strong></span></p>
<p><span lang="zh-cn"><strong><font color="#000080" face="宋体" size="4">&nbsp;
实例变量与对象相关联，只有在该对象的事件处理程序或函数中才能使用为该对象定义的实例变量。实例变量在它所关联的对象被打开时创建，被关闭时消失。</font></strong></span></p>
<p><span lang="zh-cn"><strong><font color="#800000" face="宋体" size="4">共享变量</font></strong></span></p>
<p><span lang="zh-cn"><strong><font color="#000080" face="宋体" size="4">&nbsp;
共享变量是一种静态变量，这不仅意味着它所在的对象关闭后再次打开时，共享变量依然保持对象关闭时的值，而且还意味着同一个类多个实例中的同名共享变量保
持相同的值。</font></strong></span></p>
<p><span lang="zh-cn"><strong><font color="#800000" face="宋体" size="4">局部变量</font></strong></span></p>
<p><span lang="zh-cn"><strong><font color="#000080" face="宋体" size="4">&nbsp;
局部变量在使用它的事件处理程序或函数中说明，其作用域仅限于说明它的程序段，在该程序段的任何地方均可访问局部变量，但其它程序段都不能访问本程序段中
的局部变量。运行程序后，进入某个程序段时，系统自动为局部变量分配内存，退出程序段时，局部变量占用的内存被释放。</font></strong></span></p>
<img src ="http://www.blogjava.net/keweibo/aggbug/321706.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-05-24 10:25 <a href="http://www.blogjava.net/keweibo/articles/321706.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PB 特殊字符</title><link>http://www.blogjava.net/keweibo/articles/321700.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Mon, 24 May 2010 01:40:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/321700.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/321700.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/321700.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/321700.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/321700.html</trackback:ping><description><![CDATA[<span class="sfont"><font color="#0000ff" face="宋体" lang="ZH-CN"><strong><font size="4">特殊字符</font></strong></font></span>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">&nbsp;
在字符串当中可以包括特殊字符。它们的写法如下：</font></span></strong></p>
<blockquote>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">新行（NEWLINE）：~n</font></span></strong></p>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">制表符（TAB）：~t</font></span></strong></p>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">垂直制表（VERTICAL
TAB）：~v</font></span></strong></p>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">回车（CARRIGE
RETURN）：~r</font></span></strong></p>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">换页（FORMFEED）：~f</font></span></strong></p>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">退格（BACKSPACE）：~b</font></span></strong></p>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">双引号：~"</font></span></strong></p>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">单引号：~'</font></span></strong></p>
<p align="justify"><strong><span class="sfont">
<font color="#000080" face="宋体" lang="ZH-CN" size="4">弯曲符：~~</font></span></strong></p>
</blockquote>
<img src ="http://www.blogjava.net/keweibo/aggbug/321700.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-05-24 09:40 <a href="http://www.blogjava.net/keweibo/articles/321700.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>数据窗口控件函数(轉)</title><link>http://www.blogjava.net/keweibo/articles/321698.html</link><dc:creator>KE</dc:creator><author>KE</author><pubDate>Mon, 24 May 2010 01:19:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/321698.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/321698.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/321698.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/321698.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/321698.html</trackback:ping><description><![CDATA[<p>数据窗口控件函数<br />
<br />
本节将介绍：<br />
&#183; 与数据库有关的函数 <br />
&#183; 行操作 <br />
&#183; 列操作 <br />
&#183; 数据操作 <br />
<br />
本节重点：<br />
&#183; 数据窗口控件的作用 <br />
<br />
本节难点： <br />
&#183; 　 <br />
<br />
本节要求：<br />
&#183; 掌握数据窗口控件的作用 <br />
<br />
PowerBuilder为数据窗口控件提供了丰富的函数，这些函数使用户能够在使用数据窗口控件时得心应手。<br />
<span class="Title"><br />
<font color="#000000">与数据库有关的函数</font></span><br />
这类函数完成与数据库有关的功能。</p>
<h3>一、连接数据库</h3>
<p><br />
连接数据库也就是指定事务对象。PowerBuilder提供了两个函数：SetTrans()和SetTransObject()。<br />
语法格式：<br />
dw_control.SetTrans(TransactionObject)<br />
dw_control.SetTransObject(TransactionObject)<br />
其中，dw_control是所使用的数据窗口控件，transactionObject是所要指定的事务对象。<br />
这两个函数有一个重要的区别就是在使用SetTrans()函数时，用户不需做任何数据初始化或事务对象初始化工作。用户只需要在这里填充一个事务对
象，PB就会自动完成对该事物对象的初始化以及和数据库连接的工作。而使用SetTransObject()函数时，用户必须首先把所用的事务对象连接到
数据库上。<br />
但是，这并不意味着SetTrans()函数比SetTransObject()函数更好，使用SetTrans()函数时，每调用一次函数必须连接一次
数据库，因为这个函数在每个事务处理的末端都会执行Disconnect语句。与此相反，使用SetTransObject()函数可以为数据库维持一个
开放性的连接。因此在一般情况下，为了提高效率，总是采用SetTransObject()函数。<br />
这两个函数都是成功时返回1，发生错误时返回-1。</p>
<h3>二、检索数据</h3>
<p><br />
用于检索数据的函数只有一个，就是Retrieve()函数。<br />
语法格式：<br />
dw_control.Retrieve()<br />
如果数据窗口控件上的数据窗口对象是有检索参数的，就要在这个函数调用时加上检索参数。而且检索参数必须和数据窗口对象中定义顺序一致。<br />
此函数返回一个长整型的数据，代表检索出来的数据行数。如果发生错误，将返回-1。</p>
<h3>三、更新数据</h3>
<p><br />
当用户对数据窗口对象内的数据修改后，想把这些修改反映到数据库中去时，必须使用Update()函数。<br />
语法格式：<br />
dw_control.Update()<br />
这个更新可能成功，也可能失败。一般在这个函数被调用之后，总是要做一个检查。请看下面的例子：<br />
Int li_return<br />
li_return = dw_1.Update()<br />
IF li_return = 1 THEN<br />
&nbsp;&nbsp;&nbsp;&nbsp;  COMMIT USING SQLCA;<br />
ELSE<br />
&nbsp;&nbsp;&nbsp;&nbsp;  ROLLBACK USING SQLCA;<br />
END IF<br />
在这段代码中，首先对数据窗口控件进行更新操作。但是更新只是把数据写入到客户机的内存，并没有提交到数据库中。如果更新成功，就把它提交到数据库中，如
果更新失败，就回滚到当前的事务。<br />
<br />
<font color="#000000"><span class="Title">行操作</span><br />
行操作的函数主要是对数据库中的数据进行插入、删除或选择操作。<br />
</font></p>
<h3>一、插入行</h3>
<p><br />
在DataWindow中插入一行，可以使用InsertRow()函数。<br />
语法格式：<br />
dw_control.InsertRow(rownumber)<br />
dw_control是数据窗口控件名，rownumber是要插入行的的行号。如果这个参数为0，代表在当前DataWindow的最后一行插入一空
行。<br />
InsertRow()函数返回一个长整型值，以此来代表插入的行号。如果插入失败，则返回-1。</p>
<h3>二、删除行</h3>
<p><br />
要删除DataWindow内的一行数据，则要使用DeleteRow()函数。<br />
语法格式：<br />
dw_control.DeleteRow(rownumber)<br />
其中rownumber是要删除的行号。如果该值为0，表示删除当前行。如果删除成功，返回1，失败则返回-1。</p>
<h3>三、设置当前行</h3>
<p><br />
如果要设置DataWindow中的某行为当前行，可以使用SetRow()函数。<br />
语法格式：<br />
dw_control.SetRow(rownumber)<br />
其中rownumber是要设置为当前行的行号。如果函数返回1表示成功，返回-1代表失败。</p>
<h3>四、获取当前行</h3>
<p><br />
如果想要获取DataWindow中的某行为当前行，可以使用GetRow()函数。<br />
语法格式：<br />
dw_control.GetRow()<br />
该函数没有参数，它返回一个长整型，代表当前行号。如果返回-1代表失败。如果返回0代表没有选中任何行。</p>
<h3>五、选择行</h3>
<p><br />
如果想要在DataWindow中加亮显示某一行或取消加亮显示某一行，可以使用SelectRow()函数。<br />
语法格式：<br />
dw_control.SelectRow(rownumber,select)<br />
其中，rownumber表示要加亮或者取消加这显示的行号，0表示所有行。select是一个布尔类型的值，TRUE表示加亮，FALSE表示取消加亮
显示。该函数返回1时表示成功，返回-1时表示失败。<br />
如果想要直接设置某一行为加亮，需要首先取消其它行的加亮显示状态，采用如下的两行代码：<br />
dw_1.SelectRow(0,FALSE)<br />
dw_1.SelectRow(rownumber,TRUE)</p>
<h3><br />
六、获取选择行</h3>
<p><br />
如果想要获取当前DataWindow中加亮显示的行，可以使用GetSelectRow()函数。<br />
语法格式：<br />
dw_control.GetSelectRow(rownumber)<br />
其中，rownumber为开始查找的行的行号，0表示从头开始查找。该函数返回一个长整数，表示从rownumber开始查找第一个加亮显示的行的行
号。如果失败返回0。</p>
<h3>七、滚动行</h3>
<p><br />
如果在DataWindow的末尾插入一行数据，而当前行是在DataWindow的中央，那么这种插入可能不会被用户觉察。为了改变这种情况，可以滚动
行到DataWindow的末尾，这样用户就能发现新的改变。要滚动行，可以使用ScrollToRow()函数。<br />
语法格式：<br />
dw_control.ScrollToRow(rownumber)<br />
该函数返回1时表示成功，返回-1时表示失败。<br />
与ScrollToRow()函数据功能相关的还有如下几个函数：<br />
ScrollPriorRow()：向上滚动一行<br />
ScrollNextRow()：向下滚动一行<br />
<br />
<font color="#000000"><span class="Title">列操作</span><br />
列操作类的函数主要是选择指定的列和获取列的信息。<br />
</font></p>
<h3>一、获取列</h3>
<p><br />
如果要获取当前的列号，可以使用GetColumn()函数，如果要获取当前的列名，可以使用GetColumnName()函数。<br />
语法格式：<br />
dw_control.GetColumn()<br />
dw_control.GetColumnName()<br />
这两个函数都没有参数，GetColumn()函数返回一个长整型值，代表当前的列号，GetColumnName()函数返回当前列的列名。如果返回
0，表示当前没有任何列被选择返回-1表示失败。</p>
<h3>二、设置列</h3>
<p><br />
要设置某一列为DataWindow中的当前列，可以使用SetColumn()函数。<br />
语法格式：<br />
dw_control.SetColumn(column)<br />
其中column既可以是列号，也可以是列名。当该函数返回1时表示成功，返回-1时表示失败。<br />
<br />
<font color="#000000"><span class="Title">数据操作</span><br />
数据操作类的函数主要是对DataWindow中的数据进行获取、设置。<br />
</font></p>
<h3>一、获取数据</h3>
<p><br />
如果要从DataWindow的指定行和列中获取数据，就要使用GetItem系列的函数。这个系列的函数共有五个，分别是对字符串、数字、日期、日期时
间和小数。<br />
语法格式：<br />
dw_control.GetItemString(rownumber,column)<br />
dw_control.GetItemNumber(rownumber,column)<br />
dw_control.GetItemDate(rownumber,column)<br />
dw_control.GetItemDateTime(rownumber,column)<br />
dw_control.GetItemDecimal(rownumber,column)<br />
其中，rownumber参数表示行号，column可以是列号或列名。</p>
<h3>二、设置数据</h3>
<p><br />
与获取数据所用的函数不同，设置DataWindow内指定行列处的数据只要使用一个SetItem()函数就可以了。<br />
语法格式：<br />
dw_control.SetItem(rownumber, column, value)<br />
其中rownumber表示行号，column可以是列号，也可以是列名，value表示要设置的值。但是该必须与DataWindow中指定的行列处的
数据类型一致，不然PowerBuilder会报错。<br />
SetItem()函数返回1时表示成功，返回-1时表示失败。</p>
<h3>三、数据排序</h3>
<p><br />
如果希望对DataWindow内的数据进行重新排序，而又不想重新从数据库中检索数据，可以使用SetSort()和Sort()函数。这两个函数一起
完成对DataWindow进行排序的功能。其中SetSort()函数用于设置如何排序，Sort()函数用于对DataWindow实际进行排序。<br />
语法格式：<br />
dw_control.SetSort(expression)<br />
dw_control.Sort()<br />
其中expression是一个字符串，表示排序的表达式，它的具体值是一个列名后面加一个空格，然后是"A"，表示升序，或"D"，表示降序。如果有多
个列要同时进行排序，它们之间用逗号隔开。<br />
例：dw_1.SetSort("name A,xh D")<br />
这两个函数都是返回1表示成功，返回-1表示失败。</p>
<h3>四、数据过滤</h3>
<p><br />
如果希望对DataWindow内的数据进行过滤而不重新从数据库中检索数据，可以使用SetFilter()和Filter()函数。它们一起完成对数
据的过滤功能。其中SetFilter()函数用来设置过滤条件，Filter()函数用于对DataWindow进行过滤。<br />
语法格式：<br />
dw_control.SetFiter(expression)<br />
dw_control.Fiter()<br />
其中expression是一个字符串，表示过滤的条件，它实际是一个逻辑表达式。<br />
例：<br />
dw_1.SetFilter("id&gt;\'003\' AND name like\'王%\'")<br />
dw_1.Filter()<br />
这两个函数都是返回1表示成功，返回-1表示失败。</p>
<h3>五、数据检查</h3>
<p><br />
PowerBuilder提供了两个函数用于数据的检查，它们是DeleteCount()和ModifiedCount()，其作用分别是检查
DataWindow中的数据自上一次更新到现在，被删除的行数和被修改的行数。它们一般在窗口的CloseQuery事件中使用，用来检查该窗口的
DataWindow中的数据是否有尚未保存的修改。<br />
语法格式：<br />
dw_control.DeleteCount()<br />
dw.control.ModifiedCount()<br />
它们分别返回从上一次更新到现在，DataWindow中被删除和被修改的行数。如果没有行被删除或被修改，那么它们返回0。如果出现错误则返回-1。<br />
一般情况下，如果窗口中含有可供修改的数据窗口对象，那么在窗口的CloseQuery事件中通常使用如下代码检查数据窗口对象中是否有尚未保存的数据：<br />
Int li_return<br />
IF dw_1.ModifiedCount() &gt; 0 OR dw_1.DeletedCount() &gt;0 THEN<br />
&nbsp;&nbsp;&nbsp;&nbsp;  li_return =
MessageBox("提示","数据尚未保存，是否保存？",Question!,YesNoCancel!,3)<br />
&nbsp;&nbsp;&nbsp;&nbsp;  CHOOSE CASE li_return<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  CASE 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  TriggerEvent(\'ue_save\')<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  RETURN 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  CASE 2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  RETURN 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  CASE 3<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  RETURN 1<br />
&nbsp;&nbsp;&nbsp;  END CHOOSE<br />
END IF</p>
<p>转自:http://hi.baidu.com/sundl2268/blog/item
/ecd8c513085daa0b5baf532d%2Ehtml</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/321698.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">KE</a> 2010-05-24 09:19 <a href="http://www.blogjava.net/keweibo/articles/321698.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>