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
36 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 250 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 8

Accepted Solution

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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 …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now