日期:2014-05-17 浏览次数:20974 次
/***************
* db_fun.pc
***************/
EXEC SQL INCLUDE SQLCA;
EXEC SQL DECLARE db_name DATABASE;
char lz_UserName[STRING_SIZE_30] = "";
char lz_Password[STRING_SIZE_30] = "";
char lz_DbString[STRING_SIZE_30] = "";
int select_info(STRU_MSG *asp_recv_msg,STRU_MSG *asp_send_msg)
{
sql_context sql_ctx;
EXEC SQL CONTEXT ALLOCATE :sql_ctx;
EXEC SQL CONTEXT USE :sql_ctx;
EXEC SQL CONNECT :lz_UserName IDENTIFIED BY :lz_Password AT db_name USING :lz_DbString;
char l_name[30];
EXEC SQL AT db_name select t_name into :l_name from t_emp;
……
EXEC SQL AT db_name COMMIT WORK RELEASE;
EXEC SQL CONTEXT FREE :sql_ctx;
}