日期:2014-05-17 浏览次数:20449 次
<asp:DetailsView ID="MessageView" runat="server">
</asp:DetailsView>
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace Show_Socut_Data
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
string sql = "select * from Message";
SqlDataAdapter da = new SqlDataAdapter(sql, "Data Source=MICROSO-84CASAM;Initial Catalog=dat;Integrated Security=True");
DataSet ds = new DataSet();
da.Fill(ds);
MessageView.DataSource = ds.Tables[0];
MessageView.DataBind();
}
}
}