GridView只显示其中几项数据,可是却显示全部出来了
这是定义的类
public DataSet GetTitleBy()
{
//创建连接
SqlConnection conn = new SqlConnection(FSystem.connstr);
//定义SQL语句
string cmdText = "select T_Title.*,T_User .UserName from T_Title inner join T_User on T_Title .UserId =T_User .id ";
//创建SqlDataAdapter
SqlDataAdapter da = new SqlDataAdapter(cmdText, conn);
//打开数据库的连接
conn.Open();
//创建数据集
DataSet ds = new DataSet();
//填充数据集
da.Fill(ds);
conn.Close();
return ds ;
}
这是aspx前台代码:
<table width ="100%" height ="89%" border ="0" cellpadding ="0" cellspacing ="0">
<tr valign ="top" >
<td height ="100%" colspan ="3" bgcolor ="#ffffff" >
<table width ="100%" border ="0" cellpadding ="1" cellspacing ="1" bgcolor ="#00fde9">
<tr>
<td bgcolor ="#ffffff">
<a href ="PulishPost.aspx" target ="Desktop">发布新帖子</a>
</td>
</tr>
<tr>
<td bgcolor ="#ffffff">
<asp:GridView ID ="gvTitle" runat ="server" ShowHeader ="true" >
&