请问该如何解决这个问题,谢谢.我用的是以下代码,上传EXCEL文件.
private Boolean SaveImages()
{
///'遍历File表单元素
HttpFileCollection files  = HttpContext.Current.Request.Files; /// '状态信息
System.Text.StringBuilder strMsg = new System.Text.StringBuilder();
strMsg.Append("上传的文件分别是:<hr color=red>");
try
{
for(int iFile = 0; iFile < files.Count; iFile++)
{
///'检查文件扩展名字
HttpPostedFile postedFile = files[iFile];
string fileName, fileExtension;
fileName = System.IO.Path.GetFileName(postedFile.FileName);
if (fileName != "")
{
fileExtension = System.IO.Path.GetExtension(fileName);
strMsg.Append("上传的文件类型:" + postedFile.ContentType.ToString() + "<br>");
strMsg.Append("客户端文件地址:" + postedFile.FileName + "<br>");
strMsg.Append("上传文件的文件名:" + fileName + "<br>");
strMsg.Append("上传文件的扩展名:" + fileExtension + "<br><hr>");
///'可根据扩展名字的不同保存到不同的文件夹
///注意:可能要修改你的文件夹的匿名写入权限。
postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("images/") + fileName);
}
}
Label1.Text = strMsg.ToString();
return true;
}
catch(System.Exception Ex)
{
Label1.Text = Ex.Message;
return false;
}
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{    
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void Button1_Click(object sender, System.EventArgs e)
{
string myConnectString = "Server=localhost;Database=pubs;uid=sa;pwd=;"; 
SqlConnection objConnection = new SqlConnection(myConnectString); 

OleDbConnection aa=new OleDbConnection();
string path=System.Web.HttpContext.Current.Server.MapPath("images/ee.xls");//excel的文件名 aa.ConnectionString="Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + path + ";Extended Properties=Excel 8.0";
OleDbDataAdapter a=new OleDbDataAdapter("select * from [mm$]",aa);// select 语句的写法.
   
DataSet ds=new DataSet();
a.Fill(ds);

DataGrid1.DataSource=ds;
DataGrid1.DataBind();
Button2.Visible=true;
}