public static int Insert(bool dbconOpened, string tableName, string uniqueID, int personID, int sessionID, string type, double tvMax, double tcMax, double fall, double weight, string description, double tvAvg, double tcAvg, string tvString, string tcString, int jumps, double time, string limited, string angleString, int simulated )
{
if(! dbconOpened)
Sqlite.Open();
if(uniqueID == "-1")
uniqueID = "NULL";
dbcmd.CommandText = "INSERT INTO " + tableName +
" (uniqueID, personID, sessionID, type, tvMax, tcMax, fall, weight, description, " +
"tvAvg, tcAvg, tvString, tcString, jumps, time, limited, angleString, simulated )" +
"VALUES (" + uniqueID + ", " +
personID + ", " + sessionID + ", \"" + type + "\", " +
Util.ConvertToPoint(tvMax) + ", " + Util.ConvertToPoint(tcMax) + ", \"" +
Util.ConvertToPoint(fall) + "\", \"" + Util.ConvertToPoint(weight) + "\", \"" + description + "\", " +
Util.ConvertToPoint(tvAvg) + ", " + Util.ConvertToPoint(tcAvg) + ", \"" +
Util.ConvertToPoint(tvString) + "\", \"" + Util.ConvertToPoint(tcString) + "\", " +
jumps + ", " + Util.ConvertToPoint(time) + ", \"" + limited + "\", \"" + angleString + "\", " + simulated +")" ;
LogB.SQL(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
//int myLast = dbcon.LastInsertRowId;
//http://stackoverflow.com/questions/4341178/getting-the-last-insert-id-with-sqlite-net-in-c
string myString = @"select last_insert_rowid()";
dbcmd.CommandText = myString;
int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since `ExecuteScalar` returns an object.
if(! dbconOpened)
Sqlite.Close();
return myLast;
}