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
{
}
}
Asked
Active
Viewed 328 times
0

Jon Senchyna
- 7,867
- 2
- 26
- 46

jintha arun
- 31
- 1
- 10
-
1It seems you've left the details of your *actual question* out (this is all code). Could you [edit] in a description of the problem you're having? – Josh Darnell Jun 11 '12 at 13:08
-
does not get input value in standard controls(text box,label,radio button,etc...) – jintha arun Jun 11 '12 at 13:13
-
Where are you calling this function from, and where are `con` and `cmd` defined? Also, why are you calling `Convert.ToInt(s.Length)`? s.Length should already be an int, so there's no need to convert. – Jon Senchyna Jun 11 '12 at 13:15
-
ok problem is does not get(textbox,label,radio button) value in c1upload validating file – jintha arun Jun 12 '12 at 10:48
-
i added connection, command in page load function above... – jintha arun Jun 12 '12 at 10:49
-
any one find the solution ... – jintha arun Jun 15 '12 at 04:46