Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

sqlite 3 c++

Posted on 2010-11-16
2
Medium Priority
?
504 Views
Last Modified: 2012-05-10
Hello.. i was able to connect my sqlite3 and c++ fine.. but i wanted to know what commend i use to insert data into my  tables .this is what i have so far. thank you also how do i create another table with a varchar value? so for example something like FirstName VarChar (50) , NULL :) thanks guys/gals

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

sqlite3* db;
char* db_err;

int main(int argc, char** argv) {

    db_err="AircraftTransponder";

    sqlite3_open(db_err, &db);
    sqlite3_exec(db,"create table 'HelloWorld'(id integer);", NULL, 0, &db_err);
	sqlite3_exec(db,"create table 'test'(id integer);", NULL,0,&db_err);
	sqlite3_exec(db,"create table 'bhayani'(id integer);", NULL,0,&db_err);
    sqlite3_close(db);
    return (EXIT_SUCCESS);
}  

Open in new window



0
Comment
Question by:businessesatoz
2 Comments
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 2000 total points
ID: 34184271
insert:
use the query "insert into helloWorld values (123);"

create another table

sqlite3_exec(db,"create table newtable(vccol varchar(10));", NULL, 0, &db_err);

The varchar(10) can be omitted. SQLite fields are type-less, but it is useful for your own reference.
0
 

Author Closing Comment

by:businessesatoz
ID: 34215706
thank you
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question