I have sqlite3 database file that I'm trying to get data from. When I try to open it in sqliteBrowser it will generate the tables but it ignores the data within the file so I get empty tables. This is the file: localData.sqlite
I don't know if the file is bad formatted or if I'm missing some function I have to run over it.
The file was created by a third party application on windows with the code below.
File creation
{
try
{
if (!File.Exists("queueData.sqlite"))
{
SQLiteConnection.CreateFile("queueData.sqlite");
}
using (SQLiteConnection c = new SQLiteConnection(connection))
{
c.Open();
using (SQLiteCommand cmd = new SQLiteCommand("create table if not exists vehicles (data TEXT)", c))
{
cmd.ExecuteNonQuery();
}
using (SQLiteCommand cmd = new SQLiteCommand("create table if not exists vehiclesMQTT (data TEXT)", c))
{
cmd.ExecuteNonQuery();
}
using (SQLiteCommand cmd = new SQLiteCommand("create table if not exists faces (data TEXT)", c))
{
cmd.ExecuteNonQuery();
}
using (SQLiteCommand cmd = new SQLiteCommand("create table if not exists facesMQTT (data TEXT)", c))
{
cmd.ExecuteNonQuery();
}
c.Close();
}
}
catch (Exception ex)
{
AdLogsManager.instance.writeErrorMessage("Creating DB and Table: " + ex.Message,"", "", 7001);
}
}
Data insert
{
try
{
var tableName = getTableNameByType(type);
string sql = "insert into " + tableName + " (data) values (\'" + data + "\')";
using (SQLiteConnection c = new SQLiteConnection(connection))
{
c.Open();
using (SQLiteCommand cmd = new SQLiteCommand(sql, c))
{
cmd.ExecuteNonQuery();
}
c.Close();
}
return true;
}
catch (Exception ex)
{
AdLogsManager.instance.writeErrorMessage("Saving data: " + ex.Message,"", "", 7002);
return false;
}
}
If anyone could help me solve the issue or find a way to obtain the data, I would greatly appreciate it.
Thanks.