protected void C1Upload2_ValidatingFile(object sender, C1.Web.Wijmo.Controls.C1Upload.ValidateFileEventArgs e)
{
try
{
var s = e.UploadedFile.GetStream();
byte[] imgbyte = new byte[s.Length];
s.Read(imgbyte, 0, Convert.ToInt32(s.Length));
string type = e.UploadedFile.Extension;
if (e.IsValid)
{
cmd = new SqlCommand("sp_pdm_shopping_upload", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
cmd.Parameters.Add(new SqlParameter("@sample", SqlDbType.Char, 10));
SqlParameter contentparameter = null;
contentparameter = (new SqlParameter("@image", SqlDbType.Image));
contentparameter.Direction = ParameterDirection.Input;
cmd.Parameters.Add(contentparameter);
cmd.Parameters.Add(new SqlParameter("@type", SqlDbType.Char, 10));
cmd.Parameters["@sample"].Value = txt_code.Text;
cmd.Parameters["@image"].Value = imgbyte;
cmd.Parameters["@type"].Value = "INV";
cmd.ExecuteNonQuery();
con.Close();
e.IsValid = false;
s.Close();
e.UploadedFile.Delete();
}
else
{
ErrorMsg.Visible = true;
this.ErrorMsg.Text = e.UploadedFile.FileName + Environment.NewLine;
}
}
catch
{
}
}
質問する
322 次