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

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2006
Posts: 12
Reputation: sathya_k_83 is an unknown quantity at this point 
Solved Threads: 1
sathya_k_83 sathya_k_83 is offline Offline
Newbie Poster

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

 
0
  #1
Jan 17th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,273
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 378
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

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

 
0
  #2
Jan 17th, 2007
In excel go to file>save as > choose csv.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 5
Reputation: ammarcool is an unknown quantity at this point 
Solved Threads: 0
ammarcool ammarcool is offline Offline
Newbie Poster

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

 
0
  #3
Jan 25th, 2007
Originally Posted by sathya_k_83 View Post
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;
}
}
</PRE>

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

regards,

Ammar.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC