protected void Post_Click(object sender, EventArgs e) { string connectionString = WebConfigurationManager.ConnectionStrings["photocatconnection"].ConnectionString; SqlConnection myConnection = new SqlConnection(connectionString); myConnection.Open(); string commentdata = CommentBox.Text; int photodata = int.Parse(Request.QueryString["photoID"]); DateTime dateNow = DateTime.Now; int id = (int)Session["id"]; string query = "INSERT INTO Comments (CmtText, PhotoId, UserId) VALUES ('" + commentdata + "', '" + photodata + "', '" + id + "')"; SqlCommand myCommand = new SqlCommand(query, myConnection); myCommand.ExecuteNonQuery(); CommentBox.Text = ""; CommentsList.DataBind(); myConnection.Close(); }
protected void displayComments() { DataSet ds = this.ConnSQL.getComemnts(Request.QueryString["id"].ToString()); CommentsList.DataSource = ds.Tables["comments"].DefaultView; CommentsList.DataBind(); }
protected void Page_Init(object sender, EventArgs e) { CommentsList.DataSource = AdminBasePage.SelectedMedia.Comments.Where(i => i.Status == Status.ToString() && i.LanguageID == AdminBasePage.CurrentLanguage.ID).OrderByDescending(i => i.DateCreated).ToList(); CommentsList.DataBind(); }
protected void Page_Init(object sender, EventArgs e) { CommentsList.DataSource = BaseMapper.GetDataModel().Comments.Where(i => i.Status == Status.ToString() && i.LanguageID == AdminBasePage.CurrentLanguage.ID).ToList(); CommentsList.DataBind(); }