0

我在 Visual Studio 2010 中使用 c1 上传(组件一)。它在调试时工作,但在 localhost 上不起作用。我在组件一中使用 4.0.20113.47 版本。请建议我如何解决这个问题?

    protected void C1Upload_sample_ValidatingFile(object sender, C1.Web.Wijmo.Controls.C1Upload.ValidateFileEventArgs e)
    {
        string sample_code = txt_code.Text;
        if (sample_code == "")
        {

            return;
        }
        try
        {

            var s = e.UploadedFile.GetStream();

            byte[] imgbyte = new byte[s.Length];
            s.Read(imgbyte, 0, Convert.ToInt32(s.Length));

            //sample image upload into c1caurosel
            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 = "IMG";
            cmd.ExecuteNonQuery();
            con.Close();
            getuploadimage();
            e.IsValid = false;
            s.Close();
            e.UploadedFile.Delete();

        }
        catch
        {
            return;
        }



    }
4

0 回答 0