注册 登录
编程论坛 新人交流区

DataRow[] row = ds.Tables[0].Select() 是什么用意呢?

xzhxzh 发布于 2007-11-04 10:59, 3268 次点击
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
//清除相片文件(服务器)
DataSet ds = bc.GetDataSet("select * from [file] where fileID='" + this.GridView1.DataKeys[e.RowIndex].Value.ToString() + "'", "file");
DataRow[] row = ds.Tables[0].Select();
foreach (DataRow rs in row) //将检索到的数据逐一,循环添加到Listbox1中
{
FileInfo file = new FileInfo(Server.MapPath(rs["Path"].ToString()));
file.Delete();
}
4 回复
#2
xinzhe2007-11-04 12:55
你这个是做什么的啊!说清楚好知道  啊
#3
xzhxzh2007-11-13 00:24
是一个员工记录表  里面有员工的照片  现在要删除员工的信息和照片
#4
guoxhvip2007-11-13 04:09
ds.Tables[0].Select();// 获取所有 DataRow 对象的数组
等价于ds.Tables["student"].Rows
#5
zsyutian2007-11-13 09:03
回复:(xzhxzh)是一个员工记录表 里面有员工的照片...
ds.Tables[0].Select();//
select 里面可以写满足条件的,如ds.Tables[0].Select("id>10");//
由于你select没有条件,可以理解为楼上的
1