Satyajeet Mishra Satyajeet Mishra - 1 year ago 74
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.

Answer Source

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");