- 论坛徽章:
- 0
|
连接PAYMENTS数据库,查询用户为DOLORES的薪水是多少
程序如下:- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- #include "util.h"
- #include<sqlca.h>
- EXEC SQL INCLUDE SQLCA;
- main()
- {
- EXEC SQL BEGIN DECLARE SECTION;
- float salary;
- EXEC SQL END DECLARE SECTION;
- EXEC SQL CONNECT TO PAYMENTS;
- EXEC SQL SELECT SALARY INTO :salary
- FROM employee
- WHERE name='DOLORES';
- printf("salary=%f\n",salary);
- EXEC SQL CONNECT RESET;
- return 0;
- }
复制代码 预编译出错:
db2 prep employee.sqc bindfile
LINE MESSAGES FOR employee.sqc
------ --------------------------------------------------------------------
SQL0060W The "C" precompiler is in progress.
SQL1024N A database connection does not exist. //怎么会没有连接PAYMENTS数据库呢?
SQLSTATE=08003
SQL0095N No bind file was created because of previous
errors.
SQL0091W Precompilation or binding was ended with "2"
errors and "0" warnings. |
|