SqliteJumpRj.Insert C# (CSharp) Метод

Insert() публичный статический Метод

public static 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 ) : int
dbconOpened bool
tableName string
uniqueID string
personID int
sessionID int
type string
tvMax double
tcMax double
fall double
weight double
description string
tvAvg double
tcAvg double
tvString string
tcString string
jumps int
time double
limited string
angleString string
simulated int
Результат int
    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;
    }

Usage Example

Пример #1
0
 public override int InsertAtDB(bool dbconOpened, string tableName)
 {
     return(SqliteJumpRj.Insert(dbconOpened, tableName,
                                uniqueID.ToString(),
                                personID, sessionID,
                                type, TvMax, TcMax, fall, weight,
                                description, TvAvg, TcAvg, tvString, tcString,
                                jumps, time, limited,
                                angleString, simulated));
 }
All Usage Examples Of SqliteJumpRj::Insert