private static void PrepareCommand(SqlCommand command, KurzFronta kf) { command.Parameters.AddWithValue("@IdKurzFronta", kf.IdKurzFronta); command.Parameters.AddWithValue("@IdStudent", kf.IdStudent); command.Parameters.AddWithValue("@IdKurz", kf.IdKurz); command.Parameters.AddWithValue("@TStamp", kf.Stamp); }
public static int Insert(KurzFronta kf, Database pDb = null) { Database db; if (pDb == null) { db = new Database(); db.Connect(); } else { db = pDb; } SqlCommand command = db.CreateCommand(SQL_INSERT); PrepareCommand(command, kf); int ret = db.ExecuteNonQuery(command); if (pDb == null) { db.Close(); } return(ret); }