0

I am new with C# and I have to write a program in C#. The problem is that I have a text file where the data is like this:

Name, X
Distance, 10
Time, 2:00

And I want to import the data to sql server such as the columns will be like:

Name Distance Time
X    10       2:00

I am not sure how to import it into database using C#.

Phylyp
  • 1,659
  • 13
  • 16
Learner
  • 1
  • 1
  • Hint : [`ReadAllText()`](https://msdn.microsoft.com/fr-fr/library/ms143368(v=vs.110).aspx) – Ilyes Jul 04 '17 at 02:16
  • 1
    Reference link: https://stackoverflow.com/questions/39628974/how-to-import-text-file-and-save-data-into-database – Sujith Jul 04 '17 at 02:21
  • https://stackoverflow.com/users/301857/grant-winney I have written a program to import the text file to sql server but the main question is that here the text file is very different.It is such that first line in the text file is supposed to go in 1st column of database table and 2nd line of text will go to 2nd column of database table and it will go on like this untill there is nothing to put in 1st column of database table – Learner Jul 04 '17 at 02:32
  • one more way of saying is that the row in text file will become column in database table – Learner Jul 04 '17 at 02:38
  • Possible duplicate of [How to import text file and save data into database?](https://stackoverflow.com/questions/39628974/how-to-import-text-file-and-save-data-into-database) – Hybris95 Jul 04 '17 at 07:56

0 Answers0