public int insertShow(TVShow ashow) { MySqlCommand command = connection.CreateCommand(); command.CommandText = "insert into tvshows (name,channel,estado) values ('" + ashow.name + "'," + ashow.channel + ",2)"; command.ExecuteNonQuery(); ashow.id = (int)command.LastInsertedId; return(ashow.id); }
public int existeShowChannel(TVShow ashow) { int salida; MySqlCommand command = connection.CreateCommand(); MySqlDataReader Reader; int intId, intChannel, intDescription; command.CommandText = "select id from tvshows where estado = 2 and name ='" + ashow.name + "' and channel =" + ashow.channel; Reader = command.ExecuteReader(); intId = Reader.GetOrdinal("Id"); salida = 0; while (Reader.Read()) { salida = (int)Reader.GetUInt32(intId); } Reader.Close(); return(salida); }
public int updateTvdatafiles(Transaccion atransaccion, ArrayList aprogramasdest, TVShow ashow) { MySqlCommand command = connection.CreateCommand(); string commaseparatedstring; int i; commaseparatedstring = "-1000"; for (i = 0; i < aprogramasdest.Count; i++) { AddValue avalue = (AddValue)aprogramasdest[i]; commaseparatedstring = commaseparatedstring + " , " + avalue.Value; } command.CommandText = "update tvdatafiles set channel = " + ashow.channel + " , tvshow = " + atransaccion.new_tvshow + " where id in (" + commaseparatedstring + ")"; command.ExecuteNonQuery(); return(0); }