/*******************************************************************
*File Name :update_info_tb.ec
*This is update basic person informaion from the zlxtb
*The database name :
*The table name :zlxtb
*Time :2009.5.7
*Author :zhou le xiang
*Compiler command :esql -o update_info_tb select_info_tb.ec
*******************************************************************/
//include head
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "sqlca.h"
/*
//define head
exec sql begin declare section;
int id;//use index keyword
char name[20];
int age;
char sex[8];
char tel[12];
char e_mail[30];
char addr[60];
exec sql end declare section;
*/
//main body
int main()
{
exec sql begin declare section;
int id;
char name[20];
int age;
char sex[8];
char tel[12];
char e_mail[20];
char addr[60];
exec sql end declare section;
printf("Do you want update data into the zlxtb ? 0 ----no or 1 -----yes\n");
exec sql database zlx;
if(sqlca.sqlcode)
{
printf("connect the database error[%d]\n",sqlca.sqlcode);
exit(1);
}
//update sql
exec sql update zlxtb set sex='male' where id=123456;
if(sqlca.sqlcode)
{
printf("update data into table error[%d]\n",sqlca.sqlcode);
exit(1);
}
printf("Congratulations ! you update data into table sccess!\n");
exec sql commit;
return 0;
}
阅读(580) | 评论(0) | 转发(0) |