/*******************************************************************
*File Name :basic_info_tb.ec
*This is create table about basic person informaion
*The database name :
*The table name :basic_info_tb
*Time :2009.5.7
*Author :zhou le xiang
*Compiler command :esql -o basic_info_tb basic_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(int argc,char argv[])
{
int i;
printf("Do you want create table ? the table name :basic_info_tb 0 ----no or 1 -----yes\n");
printf("choice:");
scanf("%d",&i);
if(i)
{//create table
exec sql database zlx;
if(sqlca.sqlcode)
{
printf("connect the database error[%d]\n",sqlca.sqlcode);
exit(1);
}
exec sql create table zlxtb
(
id int,
name char(20),
age int,
sex char(8),
tel char(12),
e_mail char(30),
addr char(60)
);
if(sqlca.sqlcode)
{
printf("create table error[%d]\n",sqlca.sqlcode);
exit(1);
}
printf("Congratulations ! you create table sccess!\n");
}
else
{//not create table
printf("you not create table ! bye!\n");
exit(1);
}
return 0;
}
阅读(797) | 评论(0) | 转发(0) |