}
void quit()
{
mysql_close(&mysql);
printf("數據庫已關閉 \n");
exit(1);
}
int main()
{
mysql_init(&mysql);
if (!mysql_real_connect(&mysql,"localhost", "root", NULL, "test",0,NULL,0))
{
printf( "Error connecting to database: %s",mysql_error(&mysql));
}
else
{
printf("Connected...\n");
}
int choice;
while(1)
{
menu();
printf("\n\t請選擇:");
scanf("%d",&choice);
switch(choice)
{
case 1:show();break;
case 2:insert();break;
case 3:delete();break;
case 4:search();break;
case 5:updata();break;
case 0:quit();
}
}
return 0;
}作者: bouna 時間: 2020-3-19 20:23
where is the database ?作者: bouna 時間: 2020-3-23 20:09
thank you so much