please。
#include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4 EXEC SQL INCLUDE SQLCA;
5 void sql_error();
6 int main()
7 {
8 EXEC SQL BEGIN DECLARE SECTION;
9 char user[20],pass[20],tnsname[20];
10 char NAME[5],ADRESS[10];
11 varchar puts;
12 int num,gender,phone;
13 EXEC SQL END DECLARE SECTION;
14
15 strcpy(user,"bankbonddb");
16 strcpy(pass,"bankbonddb");
17 strcpy(tnsname,"dlbond");
18 EXEC SQL WHENEVER SQLERROR DO sql_error();
19 EXEC SQL CONNECT :user IDENTIFIED BY :pass USING :tnsname;
20 printf("connecting succesfull...\n");
21
22 FILE *fp;
23 fp = fopen("sj.txt","r");
24 int i = 0;
25 char buff[20];
26 fgets(buff,10,fp);
27 num = atoi(buff);
28 fgets(buff,5,fp);
29 while(buff[i]!='\0')
39 while(buff[i]!='\0')
40 {
41 ADRESS[i] = buff[i];
42 i++;
36 fgets(buff,15,fp);
37 phone = atoi(buff);
38 fgets(buff,20,fp);
39 while(buff[i]!='\0')
40 {
41 ADRESS[i] = buff[i];
42 i++;
43 }
44 EXEC SQL EXECUTE
45 INSERT INTO WANGCL VALUES (: num,
46 :NAME ,
47 :gender,
48 :phone,
49 :ADRESS );
50 END-EXEC;
51
52 EXEC SQL COMMIT WORK RELEASE;
53 return 0;
54 }
------解决方案--------------------
啥问题呢?就贴了一堆代码?