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 ?
ASP.NET.NET ProgrammingC#
Last Comment
Prakash Samariya
8/22/2022 - Mon
funwithdotnet
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.
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!