pb中动态sql的终极解决方法

//-----------------通过sql语句动态创建一个datastore对象 

//gf_getdsfromsql

//datastore:adw_dw
//string:as_sql
//transaction:atrs_sqlca
string ERRORS, sql_syntax
string presentation_str, dwsyntax_str
sql_syntax = as_sql
presentation_str = "style(type=grid)"
dwsyntax_str = atrs_sqlca.SyntaxFromSQL(sql_syntax, presentation_str, ERRORS)
IF Len(ERRORS) > 0 THEN
   MessageBox("Caution", "SyntaxFromSQL caused these errors: " + ERRORS)
   RETURN -1
END IF
adw_dw.Create( dwsyntax_str, ERRORS)
IF Len(ERRORS) > 0 THEN
   MessageBox("Caution", "Create cause these errors: " + ERRORS)
   RETURN -1
END IF
return 0

 //-------------------------------------------------------------

//取出数据 

 ls_sql=is_sql

ds_data=create datastore
gf_getdsfromsql(ds_data,ls_sql,sqlca)
ds_data.settransobject(sqlca)
ds_data.retrieve()

 

posted @ 2011-07-14 10:04  kuailewangzi1212  阅读(2641)  评论(0编辑  收藏  举报