Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to import data from SQL Server 2008 to MS-Excel
Posted

I got a solution from my self..

Open MsExcel
Go to Data tab
Choose From Other Sources
Choose SQL Server
Choose server name and windows authentication/supply username and password
Import data
 
Share this answer
 
Comments
VJ Reddy 23-Apr-12 11:40am    
Good answer. 5!
Hey,

refer this link
http://support.microsoft.com/kb/321686[^]

Best Luck
Happy Coding :)
 
Share this answer
 
Comments
Mas11 23-Apr-12 6:58am    
Nilesh i want to import data from SQL 2008 to Excel.
 
Share this answer
 
v3
Comments
Mas11 23-Apr-12 6:59am    
Dear P.Salini, i want to import data from SQL 2008 to Excel.
 
Share this answer
 
Comments
Mas11 23-Apr-12 7:01am    
Dear Sravani.v, i want to import data from SQL 2008 to Excel.
FIST DATA BIND IN GridView
<pre lang="c#">
 protected void ButtonGetExcelRechargeReport_Click(object sender, EventArgs e)
    {
        try
        {
            Response.Clear();
            Response.AddHeader("content-disposition", "attachment;filename=SMS_Report.xls");
            Response.ContentType = "application/vnd.xls";
            System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
            GridViewRechargeReport.RenderControl(htmlWrite);
            Response.Write(stringWrite.ToString());
            Response.End();

        }
        catch (Exception ex)
        {
        }
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
        /* Verifies that the control is rendered */
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900