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
68 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 10

Accepted Solution

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

Featured Post

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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