예제 #1
0
 protected void btn_Submit_Click(object sender, ImageClickEventArgs e)
 {
     db = new DatabaseMethods();
     int a = db.InsertWithLastId("Insert into Makale (Baslik , Tarih , Icerik , KategoriID , Ozet) values ( '" + txt_Title.Text + "' , GETDATE() , '" + txt_main.Text + "' , " + ddl_Category.SelectedItem.Value + " , '" + txt_abstract.Text + "'); SELECT SCOPE_IDENTITY() as LastInsertedId;");
     foreach (ListItem item in lb_Selected.Items)
     {
         db.Insert("Insert into MakaleEtiket values(" + a + "," + item.Value + ")");
     }
     //Response.Redirect("Admin.aspx");
     db.CloseConnection();
 }
예제 #2
0
 protected void btn_Comment_Click(object sender, ImageClickEventArgs e)
 {
     string yorum = txt_Comment.Text;
     string user_id = Session["User_id"].ToString();
     DatabaseMethods db = new DatabaseMethods();
     db.OpenConnection();
     db.Insert("Insert into Yorum (YorumIcerik , MakaleID , User_id , Tarih ) values ('" + yorum + "'," + makale_id + "," + user_id + ",GETDATE())");
     txt_Comment.Text = "";
     db.CloseConnection();
     Response.Redirect("Blog.aspx?id="+makale_id+"&page="+Session["Comment_Page"].ToString());
 }