Wednesday, May 6, 2009

usage of repeater in c#





code:


using System;
using System.Data;
using System.Configuration;
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;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
SqlConnection con;

protected void Page_Load(object sender, EventArgs e)
{
con = new SqlConnection("Data Source=.;Initial Catalog=Proj_saha;Integrated Security=True ");
SqlCommand cmd = new SqlCommand("SELECT * FROM history", con);
con.Open();

//place table information into DataSet
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
rptList.DataSource = ds;
rptList.DataBind();
con.Close();
}
}



design:-





No comments:

Post a Comment