How to get SQL Server process ID with C#

May 24, 2013 in answer

0 votes, 0.00 avg. rating (0% score)

ANSWER:

To get the process id in C#

var ProcessId = Process.GetProcesses()
                        .Where(P => P.ProcessName == "sqlservr")
                        .Select(P => P.Id).FirstOrDefault();

roughnex from http://stackoverflow.com/questions/16727569