读书人

在datastore中 查询数据不,该怎么处理

发布时间: 2012-03-29 12:53:12 作者: rapoo

在datastore中 查询数据不
可以在datastore中 查询数据不?就是直接用sql语句等查出一个结果集

[解决办法]
可以...

把这个代码另存一个 .srf 文件,再import 至你的 .pbl 中即可调用.

C/C++ code
$PBExportHeader$gf_create_ds.srf$PBExportComments$构造 datastore 的全局函数global type gf_create_ds from function_objectend typeforward prototypesglobal function boolean gf_create_ds (ref transaction at_trans, ref string as_sql, ref datastore ad_datastore)end prototypesglobal function boolean gf_create_ds (ref transaction at_trans, ref string as_sql, ref datastore ad_datastore);//====================================================================// 事件: .gf_create_ds()//--------------------------------// 描述: 全局函数,用SQL 语句构造 datastore//--------------------------------// 参数://     reference      transaction       at_trans        //     reference    string       as_sql          //     reference    datastore    ad_datastore    //--------------------------------// 返回:  boolean//--------------------------------// 作者:    Wangenu        日期: 2009年12月17日//--------------------------------//    Copyright(c) 2009  Wangenu(TM).//--------------------------------// 修改历史:////====================================================================if not isvalid(ad_datastore) then ad_datastore = create datastorestring ls_errsyntaxfromSQLstring ls_errcreatestring ls_newsyntax                    at_trans.autocommit = truels_newsyntax = at_trans.syntaxfromsql(as_sql ,'style(type=grid)',ls_errsyntaxfromSQL)if len(ls_errsyntaxfromSQL) > 0 then    messagebox('生成临时表句法错误','提示:~n~n'+ls_errsyntaxfromSQL,stopsign!)    return falseelse    ad_datastore.create(ls_newsyntax,ls_errcreate)    if len(ls_errcreate) > 0 then        messagebox('生成临时表错误','提示:~n~n'+ls_errsyntaxfromSQL,stopsign!)        return false    end if    ad_datastore.settransobject(at_trans)    ad_datastore.retrieve()    end ifat_trans.autocommit = falsereturn trueend function
[解决办法]
顶~!楼上的正解,并且是动态的;
你也可以先创建一个数据窗口然后创建一个datastore,数据源为此数据窗口,剩下的和datawindow操作一样!
[解决办法]
我觉得首先应该弄清楚什么是datastore

数据存储 DataStore 对象
数据存储对象实际上就是去掉了可视特征的数据窗口控件 除了可视特征之外 数据存储对象与数据窗口控件的功能和用法相同 因此 它们有许多相同的属性 事件和函数为了支持数据存储对象的打印输出功能 该对象也提供了一些完成这项功能的事件和函数

读书人网 >PB

热点推荐