Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Is there a command to import a text file into Microsoft SQL Server 2008 using ASP.NET with Visual Studio 2010 using C# with .NetFramework 4.0 ?

Posted on 2016-08-08
3
Medium Priority
?
88 Views
Last Modified: 2016-08-09
I have an Access application that uses Access as the front end and back end.

It has an Import command button that executes the following command:

DoCmd.TransferText acImportFixed, "monthlychecks spec", "importMonthlyChecks", filenm, False

Is there a command to import a text file into Microsoft SQL Server 2008 using ASP.NET with Visual Studio 2010 using C# with .NetFramework 4.0 ?
0
Comment
Question by:zimmer9
  • 2
3 Comments
 
LVL 12

Expert Comment

by:funwithdotnet
ID: 41748242
Not exactly, but it's easy to do. Read the file with a StreamReader, parse it based on the format, then use SqlCommand.ExecuteNonQuery() to insert the data.

If you want example code to parse a tab-delimited, CSV or fixed-length file, there are plenty of examples available, probably on this site.

You could StreamReader.ReadLine() and a Substring to parse the columns & values for a fixed-length file, for example.

Good luck!
0
 
LVL 12

Assisted Solution

by:funwithdotnet
funwithdotnet earned 1000 total points
ID: 41748245
I almost forgot - once you know how to process the files, just put the whole thing in a method and viola! you have your command.
0
 
LVL 10

Accepted Solution

by:
Prakash Samariya earned 1000 total points
ID: 41748295
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question