1
Reply

case in sql when in a single column there are rows with diff conditio

Kittu Bharti

Kittu Bharti

Mar 29 2023 5:32 AM
85
using System;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        string filePath = "<your-csv-file-path>";
        using (var fileStream = new FileStream(filePath, FileMode.Open))
        using (var reader = new StreamReader(fileStream))
        {
            string headerLine = reader.ReadLine();
            while (!reader.EndOfStream)
            {
                string dataLine = reader.ReadLine();
                string[] data = dataLine.Split('|');
                string uniqueId = data[0];
                string name = data[1];
                string notes = data[2];
				//you can add your database logical code here
                Console.WriteLine($"ID: {uniqueId}, Name: {name}, Notes: {notes}");
            }
        }
    }
}

 


Answers (1)