SQLite file

nike

New member
Joined
Jun 21, 2012
Messages
1
Programming Experience
Beginner
HiI'm experimenting with SQLite. The program complies and runs fine, except I can't see the actual stored ID's in my file1.db. Am I looking in the wrong place or doing something wrong here? I would appreciate any feedback. I basically store random text from texbox into file1.db

#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SQLite;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private SQLiteConnection sqlcon;
private SQLiteCommand sqlcmd;
private SQLiteDataAdapter dataBase;
private DataSet dataSet = new DataSet();
private DataTable dataTable = new DataTable();


public Form1()
{
InitializeComponent();
createDataBase();
createDataTable();

}

private void createDataBase()
{

dataBase = new SQLiteDataAdapter();
}

private void createDataTable()
{
dataTable = new DataTable();
}


private void ExecuteQuery(string txtQuery)
{
using (SQLiteConnection sqlcon = new SQLiteConnection("Data Source=file1.db;Version=3;New=False;Compress=True;"))
{
using (SQLiteCommand sqlcmd = sqlcon.CreateCommand())
{

sqlcon.Open();
sqlcmd.CommandText = "create table records ( ID varchar(255))";
sqlcmd.CommandText = txtQuery;
sqlcmd.ExecuteNonQuery();
}
}
}

private void button1_Click(object sender, EventArgs e)
{
string txtQuery = "INSERT INTO RECORDS (ID) VALUES ('" + textBox1.Text + "')";
ExecuteQuery(txtQuery);
}


}
}
#
Thanks a lot
 

Latest posts

Back
Top Bottom