Satyajeet Mishra Satyajeet Mishra - 3 months ago 10x
SQL Question

Syntax issue in Tamir SharpSsh RunCommand

I am trying to write the following line of code in my program :

xxxx.RunCommand("echo "select count(*) from TABLE_NAME;"|sqlplus DB Connection");

Now as I understand RunCommand's syntax is RunCommand("Unix Command");

But in my program I need to use multiple " ". Please suggest what would be the correct code here. Sorry for this basic question.


If you mean about escaping them, you need to use \" instead.

xxxx.RunCommand("echo \"select count(*) from TABLE_NAME;\"|sqlplus DB Connection");

Or use verbatim string literal with doubling them.

xxxx.RunCommand(@"echo ""select count(*) from TABLE_NAME;""|sqlplus DB Connection");