可以的,这里看一个datalist的样例
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e)
{
// Create a connection to the "pubs" SQL database located on the
// local computer.
SqlConnection myConnection = new SqlConnection("server=localhost;" +
"database=pubs;Trusted_Connection=Yes");
// Connect to the SQL database using a SQL SELECT query to get all
// the data from the "Titles" table.
SqlDataAdapter myCommand = new SqlDataAdapter("SELECT * " +
" from Titles", myConnection);
// Create and fill a DataSet.
DataSet ds = new DataSet();
myCommand.Fill(ds);
// Bind MyDataList to the DataSet. MyDataList is the ID for
// the DataList control in the HTML section of the page.
MyDataList.DataSource = ds;
MyDataList.DataBind();
}
</script>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e)
{
// Create a connection to the "pubs" SQL database located on the
// local computer.
SqlConnection myConnection = new SqlConnection("server=localhost;" +
"database=pubs;Trusted_Connection=Yes");
// Connect to the SQL database using a SQL SELECT query to get all
// the data from the "Titles" table.
SqlDataAdapter myCommand = new SqlDataAdapter("SELECT * " +
" from Titles", myConnection);
// Create and fill a DataSet.
DataSet ds = new DataSet();
myCommand.Fill(ds);
// Bind MyDataList to the DataSet. MyDataList is the ID for
// the DataList control in the HTML section of the page.
MyDataList.DataSource = ds;
MyDataList.DataBind();
}
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货