老问题了,请路过的帮忙看看,顶的也有分
public void CreatTable()
{
upfiles = new DataTable( "upfile ");
DataColumn[] keys = new DataColumn[1];
keys[0] = upfiles.Columns.Add( "filename ", typeof(string));
keys[0].AllowDBNull = false;
upfiles.PrimaryKey = keys;
upfiles.Columns.Add( "filestream ", typeof(Stream));
fname.Text = " ";
}
/// <summary>
/// 增加附件到列表
/// </summary>
private void AddFile()
{
if (upfiles == null)
{
CreatTable();
}
if (myFile.PostedFile.FileName != " ")
{
string nam = myFile.PostedFile.FileName;
int i = nam.LastIndexOf( "\\ ");
string filename = nam.Substring(i + 1);
if (upfiles.Rows.Find(filename) == null)
{
Stream fstream = myFile.PostedFile.InputStream;
DataRow dr = upfiles.NewRow();
dr[0] = filename;//获取文件名
upfiles.Rows.Add(dr);//增加
ArrayList dc = new ArrayList();
for (int j = 0; j < upfiles.Rows.Count; j++)
{
DataRow df = upfiles.Rows[j];