救我試着上傳文檔並保存在目錄和數據庫還 當我上傳文件就可以在目錄中保存,但不是在數據庫 這裏是上傳文件代碼文件不在數據庫中
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)
問題出現在哪裏?
你得到一個錯誤? – SLaks
不,我沒有得到任何錯誤 – user2832406
當我設置在抓一個破發點就說明我ecpetion「輸入字符串的不正確的格式。」 – user2832406