voidmodify_qingdans_data(){intchoise;charmodify_col[20],modify_col_where[20],modify_values[20],modify_where_values[20],HUANCHONG[225];printf("该表中有一下属性:zhujiao(ch...
void modify_qingdans_data()
{
int choise;
char modify_col[20],modify_col_where[20],modify_values[20],modify_where_values[20],HUANCHONG[225];
printf("该表中有一下属性:zhujiao(char(20)),zhujiao_quhao(char(20)),beijiao(char(20)),beijiao_quhao(char(20)),start_time(date),end_time(char(6)),start_shike((char(20))),end_shike(char(6))\n");
printf("修改语句:update table set 列=value where 列=value\n\n");
printf("请输入你要修改的列的列名(请从以上选择) :");
scanf("%s",modify_col);
printf("请输入你要修改的列的目标(请从以上选择) :");
scanf("%s",modify_values);
printf("请输入你要修改的列的条件列名(请从以上选择):");
scanf("%s",modify_col_where);
printf("请输入你要修改的列的条件 (请从以上选择):");
scanf("%s",modify_where_values);
sprintf(HUANCHONG,"update qingdans set '%s'='%s' where '%s'='%s'",modify_col,modify_values,modify_col_where,modify_where_values);
if(mysql_real_query(&mysql,HUANCHONG,strlen(HUANCHONG)))
//这一步总是执行 不成功,没办法修改数据库里的数据
{
mysql_errno(mysql);
printf("sdfasdf");
getch();
}
else
{
do
{
printf("\n\n\t\t\t0.返回主菜单!\n\n\n");
printf("\t\t\t1.继续输入!\n\n\n");
printf("\t\t\t 请选择:");
scanf("%d",&choise);
}while(0!=choise&&1!=choise);
if(1==choise)
{
modify_qingdans_data();
}
}
}
展开