public void InsertComennt(Comentario_EN c) { SqlConnection nueva_conexion = new SqlConnection(Constants.nombreConexion); try { nueva_conexion.Open(); string insert = ""; insert = "Insert Into CommentsContent(User,File,Content) VALUES (" + c.User + "," + c.File + ",'" + c.Content + "')"; SqlCommand com = new SqlCommand(insert, nueva_conexion); com.ExecuteNonQuery(); } catch (Exception ex) { } finally { nueva_conexion.Close(); } }
public ArrayList ShowComennts(Comentario_EN comentario) { SqlConnection c = new SqlConnection(Constants.nombreConexion); c.Open(); SqlCommand com = new SqlCommand("Select Content from CommentsContent WHERE User="******" AND File=" + comentario.File, c); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { lista.Add(dr["Content"].ToString()); } dr.Close(); c.Close(); return(lista); }
public void DeleteComennt(Comentario_EN c) { SqlConnection nueva_conexion = new SqlConnection(Constants.nombreConexion); try { nueva_conexion.Open(); string delete = ""; delete = "Delete from Files where CommentsContent.User = "******"AND CommentsContent.File" + c.File + "AND CommentsContent.Content" + c.Content; SqlCommand com = new SqlCommand(delete, nueva_conexion); com.ExecuteNonQuery(); } catch (Exception ex) { } finally { nueva_conexion.Close(); } }