954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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

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

sathya_k_83
Newbie Poster
12 posts since Sep 2006
Reputation Points: 10
Solved Threads: 1
 

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

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 
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

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.
:)

ammarcool
Newbie Poster
5 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

how to export database

maheshbandi
Newbie Poster
1 post since May 2010
Reputation Points: 10
Solved Threads: 0
 

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.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You