protected void Button1_Click(object sender, EventArgs e)
    {
        string SID, FileName, FilePath, FileArea,SubDataTime;
        SID = Session["SID"].ToString();//学生学号
        FileName = FileUpload1.FileName.ToString();//上传文件的文件名
        FilePath = "~/uploadfile/zuoye/" + RadioButtonList1.SelectedValue.ToString() + "/";//作业上传的物理路径
        FileArea = RadioButtonList1.SelectedValue.ToString();//作业上传到该文件的所属目录
        SubDataTime = DateTime.Now.ToString();//作业上传的时间        SqlConnection con = new SqlConnection(@"Data Source=PC-200201010022\SQLEXPRESS;Initial Catalog=student-uploadfile;Integrated Security=True");
        con.Open();
        string str = "insert into homework_message(SID,FileName,FilePath,FileArea,SubDataTime) values ('"+SID+"','"+FileName+"','"+FilePath +"','"+FileArea +"','"+SubDataTime +"')";
        SqlCommand com = new SqlCommand(str,con);
        SqlDataAdapter da = new SqlDataAdapter("select * from homework_message",con);
        DataSet ds = new DataSet();
        com.ExecuteNonQuery();
        da.Fill(ds,"homework_message");
        con.Close();
        Response.Write("<script> alert ('作业上传成功')</script>");    }

我就是将SID, FileName, FilePath, FileArea,SubDataTime信息传到数据库,并没有涉及文件的存储,就是存个一些信息,为什么会出现“将截断字符串或二进制数据”,高手帮帮我把