I am trying to make a contacts table in SQLite. When i commit the changes after inserting 2-3 rows of data, and try to access it after closing the current session, my records are no longer there..
This is what i have done:-
1.Made a directory C:\Sites\databases> to store all my database related data.
2. Created a database called contactlist_development, so when i type the command dir from
C:\Sites\databases>, i can see my database.
This is where the problem starts:-
3.When i do (C:\Sites\databases>sqlite3). I am taken to the sqlite prompt, and when i make a table, its records don’t get saved once i log out:-
sqlite>BEGIN TRANSACTION;
sqlite>CREATE TABLE contacts(Cid integer primary key autoincrement,first_name varchar(15),last_name varchar(15),address varchar(15),city varchar(15),state varchar(15),country varchar(15),phone double, email varchar(20));
sqlite>COMMIT;
Then,
sqlite>BEGIN TRANSACTION;
sqlite>INSERT INTO contacts VALUES(1,'Chetan','Dahal','Bal','Kathmandu','Nepal','50060','cheta@gmail.com'));
sqlite>COMMIT;
sqlite> Ctrl-C
Then when i login again, i don’t get my records:(
Looks like you are opening an in-memory database when you run:
Can you try running this instead?
where
contactlist_developmentis your database file.