请解释一下这段代码 [英] please explain this code line
本文介绍了请解释一下这段代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友们,
我正在使用asp.net中的gridview c#
Dear frnds,
am working on gridview in asp.net c#
{
SqlConnection con = new SqlConnection(_connString);
SqlDataAdapter da = new SqlDataAdapter("Select * from StudentsInfo",con);
DataSet ds = new DataSet();
da.fill(ds);
Gridview1.datasource = ds.Tables[0];
}
请你解释一下这句话
Please can u explain me this line
Gridview1.Datasource = ds.Tables[0];
你是什么意思 ds.tables [0]
请解释。谢谢。
what do you mean by ds.tables[0]
Please explain. THANKS.
推荐答案
什么意思?这是对答案或文章的回应吗?
您应该考虑阅读一些关于C#的基础书籍,因为很明显你不是真的了解它,以便在其中工作。如您所见,ds是一个DataSet。它有一个Tables属性。这是一个数组。数组中的第一个表的索引为0. ds.Tables [0]返回数据集中的第一个表。
What does who mean ? Is this a response to an answer, or an article ?
You should consider reading some basic books on C#, because it''s clear you don''t really understand it well enough to be working in it. ds is a DataSet, as you can see. It has a Tables property. It is an array. The first table in the array has an index of 0. ds.Tables[0] returns the first table in the dataset.
熟悉的概念数据集
。
本质上,数据集是数据表对象的集合(每个对象可以对应数据库中的表)。
当你说ds.tables [0]
时,你正在访问数据集中的第一个表。
你是然后将其分配给GridView的数据源。
Get familiar with the concept of aDataset
.
Essentially, a dataset is a collection of datatable objects (each of which could correspond to a table in the database).
When you sayds.tables[0]
, you are accessing the first table in the dataset.
You are then assigning it to the datasource of the GridView.
这篇关于请解释一下这段代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文