pb游标规则、datastore、服务器时间

来源:互联网 发布:mac中英文输入法切换 编辑:程序博客网 时间:2024/06/06 05:08

获取sql server数据库时间

insert into tablename(Date)value getDate()


"select getdate() as serverDate"
然后读取serverDate属性即为SQL Server服务器时间。

也可用下面语句直接获取:
select   getdate()

select   CURRENT_TIMESTAMP


游标编程套路::

String ls_temp1
String ls_temp2

declare cur_name CURSOR FOR
 select field1,field2 from tablename
where condition
OPEN cur_name;

FETCH cur_name INTO :ls_temp1,:ls_temp2;
do while sqlca.sqlcode = 0
  //其它处理语句,尽量不要包含SQL语句。如果要包含,一定要在fetch语句之前。
 FETCH cur_dis INTO :ls_temp1,:ls_temp2;
loop

close cur_name;

摘自:http://blog.csdn.net/davinciteam/article/details/7432657



动态数据窗口生成::


Examples

These statements create a new DataWindow in the control dw_new from the DataWindow source code returned by theSyntaxFromSQL method. Errors from SyntaxFromSQL and Create are displayed in the MultiLineEdits mle_sfs and mle_create. After creating the DataWindow, you must callSetTransObject for the new DataWindow object before you can retrieve data:

string error_syntaxfromSQL, error_create
string new_sql, new_syntax
new_sql = 'SELECT emp_data.emp_id, ' &
        + 'emp_data.emp_name ' &
        + 'from emp_data ' &
        + 'WHERE emp_data.emp_salary>45000'
new_syntax = SQLCA.SyntaxFromSQL(new_sql, &
        'Style(Type=Form)', error_syntaxfromSQL)
IF Len(error_syntaxfromSQL) > 0 THEN
        // Display errors
        mle_sfs.Text = error_syntaxfromSQL
ELSE
        // Generate new DataWindow
        dw_new.Create(new_syntax, error_create)
        IF Len(error_create) > 0 THEN
            mle_create.Text = error_create
        END IF
END IF
dw_new.SetTransObject(SQLCA)
dw_new.Retrieve()

0 0
原创粉丝点击