9.10网络编程(day7)

#include
#include
typedef struct
{
	int gh;
	char name[20];
	double salary;
}Worker;
int do_insert(sqlite3 *ppDb)
{
	Worker work;
	printf("请输入插入的工号:");
	scanf("%d",&work.gh);
	printf("请输入插入的姓名:");
	scanf("%s",work.name);
	printf("请输入插入的薪水:");
	scanf("%lf",&work.salary);

	char *errmsg = NULL;//存储错误信息
	char sqlite[100];
	snprintf(sqlite,sizeof(sqlite),"insert into Work values(%d,\"%s\",%lf);",work.gh,work.name,work.salary);
	if(sqlite3_exec(ppDb,sqlite,NULL,NULL,&errmsg)!=0)//实现插入一个人工信息
	{
		perror("sqlite3_exec");
		printf("错误码:%d错误信息:%s出错行是:%d\n",sqlite3_errcode(ppDb),sqlite3_errmsg(ppDb),__LINE__);
		printf("错误信息:%s\n",errmsg);
		return -1;
	}
	printf("添加工人成功\n");
	return 0;
}
int callback(void *arg,int n,char **msgtext,char **msgtable)
{
	int i,j;
	for(i=0;i

你可能感兴趣的:(网络,jvm,java)