示例#1
0
    protected void btn_add_Click(object sender, EventArgs e)
    {
        if (CheckFileType(FileUp_hinh.FileName))
        {
            String filePath = "~/img_Nhacsi/" + FileUp_hinh.FileName;
            FileUp_hinh.SaveAs(MapPath(filePath));
        }
        string updatequery = "Update  Nhacsi Set TenNhacSi=N'" + txt_tennhacsi.Text + "',NgaySinh=N'" + txt_ngaysinh.Text + "',QuocTich=N'" + txt_quoctich.Text + "',HinhAnh=N'" + FileUp_hinh.FileName + "',GioiThieu=N'" + txt_gioithieu.Text + "' Where MaNhacSi ='" + txt_tim_nhacsi.Text + "'";

        con.Open();
        SqlCommand cmd = new SqlCommand(updatequery, con);

        cmd.ExecuteNonQuery();
        con.Close();
        Response.Redirect("QL_NhacSi.aspx?Ns=Xem");
    }
示例#2
0
    protected void btn_add_nhacsi_Click(object sender, EventArgs e)
    {
        string th  = Drop_thang.SelectedValue.ToString();
        string ng  = Drop_ngay.SelectedValue.ToString();
        string nam = txt_namsinh.Text;
        string ns  = th + "/" + ng + "/" + nam;

        if (CheckFileType(FileUp_hinh.FileName))
        {
            String filePath = "~/img_Nhacsi/" + FileUp_hinh.FileName;
            FileUp_hinh.SaveAs(MapPath(filePath));
        }

        string insert = "insert into Nhacsi (TenNhacSi,NgaySinh,QuocTich,HinhAnh,GioiThieu) Values (N'" + txt_add_tennhacsi.Text + "',N'" + ns + "',N'" + txt_add_quoctich.Text + "',N'" + FileUp_hinh.FileName + "',N'" + txt_add_gioithieu.Text + "')";

        con.Open();
        SqlCommand cmdd = new SqlCommand(insert, con);

        cmdd.ExecuteNonQuery();
        con.Close();
        Response.Redirect("QL_NhacSi.aspx?Ns=Xem");
    }