I have tried the following code but it doesn't display data in the repeater control..
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LOADINGREAPETER();
}
}
public void LOADINGREAPETER()
{
SqlConnection CN = DBUtil.GetCon();
if (CN.State != ConnectionState.Closed)
CN.Close();
CN.Open();
string q = "Select Convert(nVarchar,A.Rec_No) CRec,A.Acc_Name Descr,A.Quantity Qty,Convert(nVarchar,A.Sell_Rate) SRate,Sell_CName Sname , Sell_CCode SCCode, Sell_CValue SCValue ,Convert(float,A.Quantity*A.Sell_Rate*Sell_CValue) as SAmount, A.Service_Tax STax,Convert(nVarchar,(A.Quantity*A.Sell_Rate*Sell_CValue)* A.Service_Tax/100)Tax_Amount,Convert(Float,((A.Quantity*A.Sell_Rate*Sell_CValue)+(A.Quantity*A.Sell_Rate*Sell_CValue)* A.Service_Tax/100)) as Net From eLogs_Invoice_Charges_Details A Where A.Invoice_Code='INV1'";
SqlDataAdapter da = new SqlDataAdapter(q, CN);
DataTable dtable = new DataTable();
da.Fill(dtable);
Repeater1.DataSource = dtable;
Repeater1.DataBind();
CN.Close();
}
Please tell me how to bind data
Manoj SevdaPosted Nov 22, 2011, 12:12 AM
Rajkumar RPosted Nov 21, 2011, 6:55 AM
Satyapriya NayakPosted Nov 21, 2011, 6:34 AM
Try this...
if (!IsPostBack)
{
con.Open();
string str
str = "select * from table";
SqlCommand com = new SqlCommand(str, con);
SqlDataReader reader;
reader = com.ExecuteReader;
Repeater1.DataSource = reader;
Repeater1.DataBind();
reader.Close();
con.Close();
}
Thanks