0

我尝试上传文档并保存在目录和数据库中,当我上传文档时它保存在目录中但不在数据库中这里是上传文档代码

if (FileUploadControl.PostedFile != null && FileUploadControl.PostedFile.ContentLength
  < 102400)
        {
            string filename = Path.GetFileName(FileUploadControl.PostedFile.FileName);
            string folder = Server.MapPath("~/Docfiles/");
            Directory.CreateDirectory(folder);
            FileUploadControl.PostedFile.SaveAs(Path.Combine(folder, filename));
            try
            {
                up.fileupladdd(Txt_docde.Value, txt_dname.Value, 
             FileUploadControl.FileName, Convert.ToInt32(DropDownList1.SelectedValue),
            Convert.ToInt32(DropDownList2.SelectedValue), 
            Convert.ToInt32(Session["UserID"]),Convert.ToString(Session["UserID"]));
                StatusLabel.Text = "Success";
            }
            catch
            {
                StatusLabel.Text = "Failed";
            }
        }


        Txt_docde.Value = "";
        txt_dname.Value = "";

上传文件的 sp 是

   ALTER procedure [dbo].[fileuplaod]
   @DocDesciption nvarchar(50),
   @DocName nvarchar(50),
   @Uploadfile nvarchar(50),
  @DocTypeID int,
  @DepID int,
  @UserID int
 as
 insert into DocumentInfo(DocDesciption ,DocName,Uploadfile,DocTypeID,DepID ,UserID)
  values(@DocDesciption,@DocName,@Uploadfile,@DocTypeID,@DepID ,@UserID)

问题出在哪里?

4

1 回答 1

1

As the error is trying to tell you, you're calling Convert.ToInt32 on something that isn't a number.

于 2013-09-30T22:08:26.290 回答