0
파일이 해당 경로하지만 테이블 (이 FileInfo)에 업로드되어 업데이트되지 .. 파일을 서버에 업로드 된 후 테이블 그 갱신을 달성하는 방법데이터베이스 테이블을 업데이트하는 방법 후 AjaxFileUpload ASP.NET
protected void UploadComplete(Object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
string str = RadioButton1.Text;
string path = Server.MapPath("~/" + str +"/") + e.FileName;
AjaxFileUpload1.SaveAs(path);
SqlConnection con = new SqlConnection("Data Source=localhost\\sqlexpress; Initial Catalog=example;user ID=sa;password=*******;");
con.Open();
string command1 = "insert into fileinfo(fileid,filename,date1) values(@fileid,@filename,@date1)";
SqlCommand command = new SqlCommand(command1, con);
command.Parameters.AddWithValue("@fileid", "101");
command.Parameters.AddWithValue("@filename", e.FileName);
command.Parameters.AddWithValue("@date1", DateTime.Now);
command.ExecuteNonQuery();
}
당신의 SQL 문이 작동하는지 확인 했습니까? – jiiri
yea..the SQL 문이 잘 작동하고 있습니다. 별도의 버튼 클릭 이벤트로 테스트 했으므로 ... 파일 업로드 후이 UploadComplete에서 실행되지 않습니다. – Vikash