我的数据是fname,lname
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
myConnection=new SqlConnection("server=127.0.0.1;uid=sa;pwd=sa;database=qqq;");
strSQL="SELECT fname AS [First Name], lname AS [Last Name FROM Employee";
myCommand=new SqlDataAdapter(strSQL,myConnection);
myCommand.Fill(ds,"Employee");
ds.Tables[0].Columns.Add("No");
DataGrid1.DataSource=ds.Tables["Employee"].DataSet;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
for (int i=0;i<ds.Tables[0].Rows.Count;i++)
{
ds.Tables[0].Rows[i]["No"]=i+1;
}
DataGrid1.DataBind();
}
}
但是显示时候结构是No,First Name,Last Name,No,最后这个No怎么去掉,请指导下,谢谢!
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/CuteSoft_Client/CuteEditor/images/emembarrassed.gif)