Hi , can u help with a code to convert to get a data set
& convert the values in a table to .csv file which can be viewed in a Excel sheet
how to create an .csv (comma separated) file using an VB.net programming

ie

converting data in a table into csv (comma separated) file

the by getting a data set & converting the values in a table into a .csv file using an VB.net coding

Member Avatar for iamthwee

In excel go to file>save as > choose csv.

sathya_k_83: Hi , can u help with a code to convert to get a data set 
& convert the values in a table to .csv file which can be viewed in a Excel sheet
how to create an .csv (comma separated) file using an VB.net programming

ie

converting data in a table into csv (comma separated) file

the by getting a data set & converting the values in a table into a .csv file using an VB.net coding

hii its very easy!!

EXPORT TO EXCEL:

private void btnExport2_Click(object sender, System.EventArgs e)
{
    // Export the details of specified columns
    try
    {
        // Get the datatable to export
        DataTable dtEmployee = ((DataSet) 
             Session["dsEmployee"]).Tables["Employee"].Copy();
        // Specify the column list to export
        int[] iColumns = {1,2,3,5,6};
        // Export the details of specified columns to Excel
        RKLib.ExportData.Export objExport = new RKLib.ExportData.Export("Web");
        objExport.ExportDetails(dtEmployee, 
             iColumns, Export.ExportFormat.Excel, "EmployeesInfo2.xls");
    }
    catch(Exception Ex)
    {
        lblError.Text = Ex.Message;
    }
}

EXPORT TO CSV

<PRE lang=cs id=pre1 style="MARGIN-TOP: 0px" nd="77">private void btnExportCSV_Click(object sender, System.EventArgs e)
{
    // Export the details of specified columns
    try
    {
        lblMessage.Text = "";

        // Get the datatable to export
        DataTable dtEmployee = dsEmployee.Tables["Employee"].Copy();
        // Specify the column list to export
        int[] iColumns = {1,2,3,5,6};
        // Export the details of specified columns to CSV
        RKLib.ExportData.Export objExport = new RKLib.ExportData.Export("Win");
        objExport.ExportDetails(dtEmployee, 
             iColumns, Export.ExportFormat.CSV, "C:\\EmployeesInfo.csv");
        lblMessage.Text = "Successfully exported to C:\\EmployeesInfo.csv";
    }
    catch(Exception Ex)
    {
        lblMessage.Text = Ex.Message;
    }
}

refer this URL:
http://www.codeproject.com/aspnet/ExportClassLibrary.asp

regards,

Ammar.
:)

how to export database

maheshbandi

Please do not resurrect old threads. If you have any questions please ask. .... You are welcome to start your own threads.

Please read the rules before posting again - http://www.daniweb.com/forums/thread78223.html and rules.

Thread Closed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.