1
Answer

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

Kittu Bharti

Kittu Bharti

2y
117
1
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}");
            }
        }
    }
}
C#
Answers (1)
0
Sandeep Singh Shekhawat
NA 22.4k 12m 12y
Server is property under "System.Web.UI" namespace and class is "Page". So are you sure that here we are using Page class (Inherit) of "System.Web.UI" namespace.

When we are working on .aspx.cs page that time this *.aspx.cs inherits System.Web.UI.Page class so we get Server.MapPath.

So please make sure that in your page you are using System.Web.UI.Page.

***************************************************************
Hi,

As per my understanding you are using Server.MapPath in your static method so Server.MapPath will not come in static method. 

Please check your method should not be static where you are using Server.MapPath.