Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Dear Coders,
 
I would like to have some help regarding the following actions:
 
1) Export Data from Visual Studio to Text file.
2) Export Data from Visual Studio to Excel Sheet.
3) Import Data to Visual Studio From Text File.
4) Import Data to Visual Studio From Excel File.
 
I surely need help regarding this...
Posted 23-Oct-12 4:08am
Comments
joshrduncan2012 at 23-Oct-12 9:09am
   
What attempts have you made in regards to accomplishing this task so far?
armarzook at 23-Oct-12 9:19am
   
I really have no idea regarding this and I am a novice to visual studio and SQL server.. I really need help...
joshrduncan2012 at 23-Oct-12 9:26am
   
We will not do the work for you. This forum is designed to assist with issues in existing code that are preventing a task from being successfully completed. I strongly urge studying Visual Studio (2010/2012) and SQL Server and how to import/export to and from Excel. Have you tried researching material on google/bing before asking this question?
armarzook at 23-Oct-12 9:34am
   
Doing researching for the past one week but till now only got to know how to export and import Data from SQL server directly... still didn't get a clue for that In visual studio...
OriginalGriff at 24-Oct-12 6:24am
   
You need to improve your question!
Change the tags: the basic thrust of your problem has nothing to do with SQL, or reporting - it is to do with writing code to save information. As such, we need to know what language you are trying to work in - VB? C#? C++? ... - (so we don't confuse you by giving you a solution in the wrong language) and also what you have tried so we don't talk you through what you have done already.
 
How you save data depends on a lot of factors: what kind of data it is is a major one of them!
Use the "Improve question" widget to edit your question and provide better information.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I believe a book on .NET programming will cover the basics as there is not a quick answer. I assume you are reading from a SQL Server and what to input/output from/to the file types listed. When looking for a book look for input / output or IO chapters.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

It seems that no one can satisfy all your needs. what I know is only to export data to text including dif,csv,sylk,txt and to excel sheet including multiple excel worksheets. I can provide some source code to you here, may it help you.It is c# code:
 
    OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=;Data Source="".\..\database\demo.mdb"";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False";
            OleDbCommand command = new OleDbCommand();
            command.CommandText = "select * from parts";
            command.Connection = connection;
           //Xls export
            Spire.DataExport.XLS.CellExport cellExport1  = new Spire.DataExport.XLS.CellExport();
            cellExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
            cellExport1.FileName = "sample.xls";
            cellExport1.SQLCommand = command;
            cellExport1.SaveToFile();
            //Txt export
            Spire.DataExport.TXT.TXTExport txtExport1 = new Spire.DataExport.TXT.TXTExport();
            txtExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
            pdfExport1.FileName = "sample.txt";
            pdfExport1.SQLCommand = command;
            pdfExport1.SaveToFile();
            //Sylk export      
            txtExport1.ExportType =Spire.DataExport.TXT.TextExportType.SYLK;
            txtExport1.FileName = "sample.slk";
            txtExport1.SaveToFile();
            //Csv export
            txtExport1.ExportType = Spire.DataExport.TXT.TextExportType.CSV;
            txtExport1.FileName = "sample.csv";
            txtExport1.SaveToFile();
            //Dif export
            txtExport1.ExportType = Spire.DataExport.TXT.TextExportType.DIF;
            txtExport1.FileName = "sample.dif";
            txtExport1.SaveToFile();
 
 
these code is the source code of a dataexport component[^], I am suggested to use it, it can not help you all but half. So you can compile the code and try to realize your other task.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 24 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100