protected void pubbtn_Click(object sender, EventArgs e) { try { travel_record record = new travel_record(); record.user_id = 3; record.record_author = "11"; record.record_title = title.Text.Trim(); record.record_cont = "11"; record.pub_time = DateTime.Now.ToLocalTime(); record.col_count = 0; record.comt_count = 0; record.like_count = 0; record.record_cover = "ww"; int result = Travel_recordManager.InsertTravel_record(record); if (result >= 1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "true", "<script>alert('游记发表成功!');</script>"); } } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "true", "<script>alert('发布失败!请仔细检查');</script>"); } }
public int InsertTravel_record(travel_record travel_Record) { string sql = "insert into travel_record(user_id,record_author,record_title,record_cont,record_cover) values (@user_id,@record_author,@record_title,@record_cont,@record_cover)"; SqlParameter[] para = { new SqlParameter("@user_id", travel_Record.user_id), new SqlParameter("@record_author", travel_Record.record_author), new SqlParameter("@record_title", travel_Record.record_title), new SqlParameter("@record_cont", travel_Record.record_cont), new SqlParameter("@record_cover", travel_Record.record_cover) }; return(DBHelper.GetExcuteNonQuery(sql, para)); }
public static int InsertTravel_record(travel_record travel_Record) { return(itravel_record.InsertTravel_record(travel_Record)); }