Solved

sqlite 3 c++

Posted on 2010-11-16
2
492 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 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Database tuning – How to start and what to tune. This question is frequently asked by many people, both online and offline. There is no hard and fast rule-of-thumb for performance tuning, however, before beginning the tuning process one should a…
Read about achieving the basic levels of HRIS security in the workplace.
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now