Fill This Form To Receive Instant Help
Homework answers / question archive / Sqlite with C language(just C, not C++ or anthing else) how can i insert data into the database with C language after i open my db with the code i have? #include <stdio
Sqlite with C language(just C, not C++ or anthing else)
how can i insert data into the database with C language after i open my db with the code i have?
#include <stdio.h>
#include <sqlite3.h>
int main(int argc, char* argv[]) {
sqlite3* db;
int c;
int pick;
c = sqlite3_open_v2("Data.db", &db, SQLITE_OPEN_READWRITE, NULL);
if(c != SQLITE_OK) {
printf("Can not open database! %sn", sqlite3_errmsg(db));
return(0);
} else {
printf("Connect to database successfully.n");
}
printf("Welcome to the Data application:n 0)Exitn 1)Add a new Stuff");
scanf("%d", pick );
if(pick==1){
//how to do it?
//Stuff is the table which has 2 attributes, Id is PK, Name is UK(unique key)
}
if(pick ==0){
sqlite3_close(db);}