pb遊標規則、datastore、伺服器時間

happymagic發表於2016-04-06

獲取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 the SyntaxFromSQL method. Errors from SyntaxFromSQL and Create are displayed in the MultiLineEdits mle_sfs and mle_create. After creating the DataWindow, you must call SetTransObject 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()

相關文章