Skip to content
Advertisement

How to get error from “SQLCMD” through c#?

Running SqlCmd utility using C# this way :

Now, If any error occurred in script while running from C# then how can fetch that SQL Exception in C#.

Advertisement

Answer

First, let’s declare a class for executioning result:

Then we can put

Usage

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement