Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


Closed Thread
  Search this Thread
Old 10-08-2011, 04:36 AM   #1
Registered: Dec 2008
Distribution: Ubuntu Fedora
Posts: 445

Rep: Reputation: 18
can not create sqlite table with C API

I am new in sqlite and this is my C code :

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

int main()
 sqlite3 *db;
 sqlite3_stmt *stmt;
 char *sqlitequery="create table ee (row INTEGER PRIMARY KEY,a INTEGER);";
 int rc = 0;

   rc = sqlite3_open("eh.db", &db);
   if( rc )
     fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
     rc = sqlite3_prepare_v2(db, sqlitequery, strlen(sqlitequery), &stmt, 0);
     printf("return value %d:",rc);
     if( rc )
       fprintf(stderr, "SQL error: %d : %s\n", rc, sqlite3_errmsg(db));
 return 0;
this code makes database file for me but it does not create its table named "ee" into it.
what is wrong with it?
Old 10-08-2011, 04:38 AM   #2
Registered: Dec 2008
Distribution: Ubuntu Fedora
Posts: 445

Original Poster
Rep: Reputation: 18
sorry I saved this post two times...
Old 10-08-2011, 09:33 AM   #3
Senior Member
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
Please follow discussion here:

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
can not create sqlite table with C API golden_boy615 Programming 2 10-08-2011 04:08 PM
LXer: Sqlite-Commander - A ncurses based tool to display the records and tables of a sqlite database LXer Syndicated Linux News 0 01-02-2011 08:11 AM
How to read the start address of the ACPI table ? are there any kernel API? jitendrapradhan Linux - Kernel 0 10-08-2008 03:24 AM
function or api to create account ssonnagi Linux - General 2 02-07-2006 03:57 AM
route table lookup Kernel API ?? Nalin Gupta Programming 0 07-01-2004 03:04 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration