c#中datalist的问题
小弟我做毕业设计时遇到一个很变态的问题:
datalist只能显示两条记录,有时候只显示一条记录。找不到原因,请各位前辈指教,数据库是mysql:
aspx.cs部分:
MySqlConnection conn = new MySqlConnection( "Server=localhost;Database=ship_net;User id=root;Password=;charset=gb2312 ");
protected void Page_Load(object sender, EventArgs e)
{
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = this.conn;
DataSet ds = new DataSet();
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "book_select ";
MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
adapter.Fill(ds, "book ");
default_datalist.DataSource = ds.Tables[ "book "].DefaultView;
default_datalist.DataBind();
}
aspx部分:
<td>
<ASP:DATALIST id= "default_datalist " runat= "server " Data Width= "570px ">
<HeaderTemplate>
<font face= "宋体 "> </font>
</HeaderTemplate>
<SelectedItemTemplate>
<table style= "FONT: 10.5pt 宋体 " cellPadding= "10 ">
<tr>
<td valign= "top "> <img id=s_img src= 'E:\ship_net\file\1.jpg ' width=115 height= "150 " align= "left " border= "1 ">
</td>
<td valign= "top ">
<asp:linkbutton id=s_link style= "COLOR: darkred " runat= "server " Text= ' <%#DataBinder.Eval(Container.DataItem, "book_name ")%> ' CommandName= "select " Font-Bold= "true ">
</asp:linkbutton> <br>
<b> 作者: <%#DataBinder.Eval(Container.DataItem, "book_author ")%> </b> <br>
<b> 价格: <%#DataBinder.Eval(Container.DataItem, "book_saleprice ")%> </b> <br>
</td>
</tr>
</table>
</SelectedItemTemplate>
<ItemTemplate>
<table style= "FONT: 10.5pt 宋体 " cellPadding= "10 ">
<tr>
<td valign= "top "> <img id=i_img src= 'E:\ship_net\file\1.jpg ' align=top border=1 height=