Databases Reference
In-Depth Information
char PID[11];
sqlint32 quantity;
char location[129];
EXEC SQL END DECLARE SECTION;
EXEC SQL INCLUDE SQLCA;
void add_product(void);
void update_product(void);
void query_product(void);
main()
{
int option;
// Connect to the SAMPLE database
EXEC SQL CONNECT TO sample;
if (sqlca.sqlcode!=0){
printf("Database connection error occurred. Sqlcode: %d
Sqlstate: %s\n",sqlca.sqlcode, sqlca.sqlstate);
return;
}
while(1){
printf("-------------------------------------------------\n");
printf(" SIMPLE INVENTORY MANAGEMENT SYSTEM \n\n");
printf(" 1. Add New Product \n");
printf(" 2. Update Product Info (Quantity or Location) \n");
printf(" 3. Query Product \n");
printf(" 4. Exit \n\n");
printf(" Enter option: ");
scanf("%d", &option);
switch(option) {
case 1:add_product();
break;
case 2:update_product();
break;
case 3:query_product();
break;
case 4:return 0;
default : printf(" Error: Option not recognized\n");
break;
}
Search WWH ::




Custom Search