日期:2014-05-17 浏览次数:20420 次
//读写数据表--DataTable
public DataTable ReadTable(String strSql)
{
DataTable dt=new DataTable();//创建一个数据表dt
SqlConnection Conn = new SqlConnection(strConn);//定义新的数据连接控件并初始化
Conn.Open();//打开连接
SqlDataAdapter Cmd = new SqlDataAdapter(strSql, Conn);//定义并初始化数据适配器
Cmd.Fill(dt); //将数据适配器中的数据填充到数据集dt中
Conn.Close();//关闭连接
return dt;
}
<asp:HyperLinkField DataNavigateUrlFields="userid" DataNavigateUrlFormatString="profile.aspx?id={0}"
DataTextField="username" DataTextFormatString="·{0}" HeaderText="username">
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="profile.aspx.cs" Inherits="profile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:DataList ID="DataList1" runat="server" RepeatColumns="1" Font-Bold="False"
Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" HorizontalAlign="Center">
<FooterStyle BackColor="Silver" Font-Bold="False" Font-Italic="False"
Font-Names="楷体" Font-Overline="False" Font-Size="Larger" Font-Strikeout="False"
Font-Underline="False" ForeColor="Red" HorizontalAlign="Justify"
VerticalAlign="Bottom" />
<HeaderStyle BackColor="Lime" Font-Bold="False" Font-Italic="False"
Font-Names="华文楷体" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" ForeColor="Blue" HorizontalAlign="Center"
VerticalAlign="Middle" />
<ItemTemplate>
<table style="width: 100%">
<tr>
<td>
<%# DataBinder.Eval(Container.Da