I've solved my problem at SQLite sqlite3_column_origin_name function with a simply workaround but now I've an another big problem.
I've a sqlwrapper with these imports:
[DllImport("sqlite3.dll", EntryPoint = "sqlite3_column_int")]
static extern int sqlite3_column_int(IntPtr stmHandle, int iCol);
[DllImport("sqlite3.dll", EntryPoint = "sqlite3_column_text")]
static extern string sqlite3_column_text(IntPtr stmHandle, int iCol);
[DllImport("sqlite3.dll", EntryPoint = "sqlite3_column_double")]
static extern double sqlite3_column_double(IntPtr stmHandle, int iCol);
and this is my ExecuteQuery function:
public DataTable ExecuteQuery(String query)
{
SQLiteWrapper.query = query;
if (!_open)
throw new SQLiteException("SQLite database is not open.");
//prepare the statement
IntPtr stmHandle = IntPtr.Zero;
try
{
stmHandle = Prepare(query);
}
catch(Exception e)
{
Log.e(e.Message);
return null;
}
// Prevensione sul out of memory
if(stmHandle == IntPtr.Zero)
{
return null;
}
//get the number of returned columns
int columnCount = sqlite3_column_count(stmHandle);
DataTable dTable = null;
try
{
//create datatable and columns
dTable = new DataTable();
for (int i = 0; i < columnCount; i++)
{
try
{
ArrayList selections = Utils.getQuerySelection(query);
foreach(String s in selections)
{
dTable.Columns.Add(s);
}
//Workaround for sqlite3_column_origin_name
//dTable.Columns.Add("_id");
//dTable.Columns.Add(sqlite3_column_origin_name(stmHandle, i));
}
catch(Exception e)
{
}
}
//populate datatable
while (sqlite3_step(stmHandle) == SQLITE_ROW)
{
object[] row = new object[columnCount];
for (int i = 0; i < columnCount; i++)
{
switch (sqlite3_column_type(stmHandle, i))
{
case SQLITE_INTEGER:
// WORKS CORRECTLY!!!!
row[i] = sqlite3_column_int(stmHandle, i);
break;
case SQLITE_TEXT:
// ERROR!!!!!!!!!!!!!!!!!!!!!!
row[i] = sqlite3_column_text(stmHandle, i);
break;
case SQLITE_FLOAT:
row[i] = sqlite3_column_double(stmHandle, i);
break;
}
}
dTable.Rows.Add(row);
}
}
catch(AccessViolationException ave)
{
Log.e("SqliteWrapper - AccessViolationException - " + ave.Message + ":" + query);
return null;
}
// Se ci sono stati errori allora torna null e ritenta la query
Boolean finalized = Finalize(stmHandle);
if(!finalized)
{
return null;
}
return dTable;
}
When I invoke the sqlite3_column_text(...) my app crashes. I've explored functions within dll file and this entrypoint "sqlite3_column_text" exists.
Can I solve my problem?
EDIT: I download my sqlite3.dll file from http://sourceforge.net/projects/sqlite-dotnet2/files/SQLite%20for%20ADO.NET%202.0/1.0.66.0/
File is within /bin/x64 and I've renamed it into sqlite3.dll
EDIT 2: Clicking on more info I have:
File che contribuiscono alla descrizione del problema:
C:\Users\Utente\AppData\Local\Temp\WERB927.tmp.WERInternalMetadata.xml C:\Users\Utente\AppData\Local\Temp\WERD59D.tmp.appcompat.txt
C:\Users\Utente\AppData\Local\Temp\WERD5BD.tmp.mdmpLeggere l'informativa sulla privacy online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0410Se l'informativa sulla privacy online non è disponibile, leggere quella offline: C:\Windows\system32\it-IT\erofflps.txt