日期:2014-05-17 浏览次数:20510 次
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<tr>
<td class="css">
<asp:CheckBox ID="CheckBox1" runat="server" CssClass="css" Text='<%# DataBinder.Eval(Container.DataItem,"user_name")%>'>
</asp:CheckBox>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
private void Bind_DealMan()
{
//定义数据连接对象,其中数据库连接字符串是在Web.Config文件中定义的
obj.open();
//创建数据适配器对象
OleDbDataAdapter da = new OleDbDataAdapter("select * from employee order by idx asc", obj.myconn);
//创建DataSet对象
DataSet ds = new DataSet();
try
{
da.Fill(ds, "employee");
Repeater1.DataSource = ds.Tables["employee"];
Repeater1.DataBind();
}
catch (Exception error)
{
obj.myconn.Close();
obj.myconn.Dispose();
Response.Write(error.ToString());
}
}