hi Irshad

u can do tht:

protected void btnExcel_Click(object sender, EventArgs e)
        {
            DataSet dsExport = new DataSet();
            StringWriter tw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(tw);
            DataGrid dgGrid = new DataGrid();

            DataSet ds = new DataSet();
            SqlParameter[] arrParamArgs =  { new SqlParameter("",)

                                                           };
            dsExport = dbl.GetDataSetProc("Proc_name", arrParamArgs);

            dgGrid.DataSource = dsExport.Tables[0];

            //Report Header
            hw.WriteLine("<b><u><font size='5'>ATR Report</font></u></
b>");

            //Get the HTML for the control.
            dgGrid.HeaderStyle.Font.Bold = true;
            dgGrid.DataBind();
            dgGrid.RenderControl(hw);

            //Write the HTML back to the browser.
            Response.ContentType = "application/vnd.ms-excel";
            Page.EnableViewState = false;

            Response.Write(tw.ToString());
            Response.End();
        }



call this on export button click event.

TC
shini
On Sep 23, 8:53 pm, "Mohd Irshad Hasmat Ansari"
<[EMAIL PROTECTED]> wrote:
> I m developing a application where I have to make a report from sql server
> to excel. I don’t know how to do that please somebody help me.
>
> Sql server à C# à excel
>
> I need to import some particular column only
>
> Thanks
>
> Irshad

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to