private void ShowPicture(string pictureId) { if (string.IsNullOrEmpty(pictureId) == false) { var selectsql = SelectSQL.SelectPictureWithId(pictureId); var dt = DLL.BindData.ReturnDataTable(selectsql); if (dt != null && dt.Rows.Count > 0) { BackgroundImage = Image.FromFile(dt.Rows[0]["PicturePath"].ToString()); } } }
private void ProductInfo_Load(object sender, EventArgs e) { if (_opearType == "修改") { var selectsql = SelectSQL.SelectProductWithId(_productId); var dt = BindData.ReturnDataTable(selectsql); if (dt != null && dt.Rows.Count > 0) { //绑定页面数据 txtProductName.Text = dt.Rows[0]["ProductName"].ToString(); txtProductCode.Text = dt.Rows[0]["ProductCode"].ToString(); txtInPrice.Text = dt.Rows[0]["InPrice"].ToString(); txtOutPrice.Text = dt.Rows[0]["OutPrice"].ToString(); txtProductNum.Text = dt.Rows[0]["ProductNum"].ToString(); txtRemark.Text = dt.Rows[0]["Remark"].ToString(); _clientId = int.Parse(dt.Rows[0]["ClientInfo"].ToString()); _pictureId = dt.Rows[0]["PictureInfo"].ToString(); //绑定客户数据 selectsql = SelectSQL.SelectClientWithId(_clientId); dt = BindData.ReturnDataTable(selectsql); if (dt != null && dt.Rows.Count > 0) { lblClientName.Text = dt.Rows[0]["ClientName"].ToString(); lblClientPhone.Text = dt.Rows[0]["ClientPhone"].ToString(); } //绑定图片数据 selectsql = SelectSQL.SelectPictureWithId(_pictureId); dt = BindData.ReturnDataTable(selectsql); if (dt != null && dt.Rows.Count > 0) { pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox1.ImageLocation = dt.Rows[0]["PicturePath"].ToString(); } } button1.Text = "修改商品"; } }