Q:

defining query string in asp.net

This query run directly in PostgreSQL panel but when i define in my code same Query , query string get me error ,How to define in proper manner in asp.net 
My code is :-
  string sQuery = "SELECT 'Inspection Completed' as "MCD Status" ,COUNT(*) as "Number of Count" FROM ud_document WHERE status = 'Inspection Completed' AND name_owning_agency like '%MZONE%' union 
  SELECT 'Pending' , COUNT(*) FROM ud_document WHERE status = 'Pending' AND name_owning_agency like '%MZONE%'
  union
  SELECT 'Approved' , COUNT(*) FROM ud_document WHERE status = 'Approved' AND name_owning_agency like '%MZONE%'
  union
  SELECT 'Rejected' , COUNT(*) FROM ud_document WHERE status = 'Rejected' AND name_owning_agency like '%MZONE%'";

A:

Looks like you need to escape double quotes ("). 
If you need more information around string literals take a look at the official Microsoft documentation: https://msdn.microsoft.com/en-us/library/aa691090(v=vs.71).aspx
Try the following:
string sQuery = "SELECT 'Inspection Completed' as \"MCD Status\" ,COUNT(*) as 
\"Number of Count\" FROM ud_document WHERE status = 'Inspection Completed' AND 
name_owning_agency like '%MZONE%' union 
SELECT 'Pending' , COUNT(*) FROM ud_document WHERE status = 'Pending' AND 
name_owning_agency like '%MZONE%'
union
SELECT 'Approved' , COUNT(*) FROM ud_document WHERE status = 'Approved' AND 
name_owning_agency like '%MZONE%'
union
SELECT 'Rejected' , COUNT(*) FROM ud_document WHERE status = 'Rejected' AND 
name_owning_agency like '%MZONE%'";

