C#后台 给(dataset)ds添加一列并赋值,总说我(红色区域)输入字符串的格式不正确
lc12d 2009-07-05 11:41:22 DataColumn filepath = new DataColumn("filepath", Type.GetType("System.String"));
filepath.AutoIncrement = true;
filepath.AutoIncrementSeed = 0;
filepath.AutoIncrementStep = 1;
ds.Tables["news"].Columns.Add(filepath);
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
if (ds.Tables["news"].Rows[i]["content"].ToString().Length > 11)
ds.Tables["news"].Rows[i]["filepath"] = ds.Tables["news"].Rows[i]["content"].ToString().Substring(0,11)+"..."; else
ds.Tables["news"].Rows[i]["filepath"] = ds.Tables["news"].Rows[i]["content"].ToString();
}
如题