Solved

sqlite 3 c++

Posted on 2010-11-16
2
498 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 500 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

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
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…

751 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