I have a method that takes an SQL string and returns a DataTable object from a SQLite data base. This works just fine, but when I look at the DataColumns in the DataTable the DataType returned is always "System.Object". How do I get it to return the correlating DataType that matches up with SQLite (ex. VARCHAR2 = System.String, BOOL = System.Boolean, ....). Below is the code I have for creating the DataTable. Is there some addition step that I can get without having to hard code the appropriate type cast?
public DataTable GetDataTable
(
string sql
)
{
DataTable dt = new DataTable();
try
{
openConnection();
SQLiteCommand mycommand = new SQLiteCommand(m_cnn);
mycommand.CommandText = sql;
SQLiteDataReader reader = mycommand.ExecuteReader();
dt.Load(reader);
reader.Close();
closeConnection();
}
catch (Exception e)
{
throw new DatabaseException(DatabaseException.DatabaseExceptionTypes.GetDataTable,e);
}
return dt;
enter code here