Create Database in C by R4R Team

program-

#include < stdio.h>
#include< sqlite3.h>

int main(int argc, char* argv[]) {
sqlite3 *db;
char *z= 0;
int rc;
rc = sqlite3_open("first.db", &db);
if(rc) {
fprintf(stderr, "Can't open database: %sn", sqlite3_errmsg(db));
return(0);
} else {
fprintf(stderr, "Opened database successfullyn");
}
sqlite3_close(db);
}


output-

Open database successfully

-In this program, we just open our database.
-If any problem will occur then error will display in the if statement otherwise else part is execute and it display the above output.




Leave a Comment: