I have a query that returns data from sql-server and I need to be able to put the results into PostgreSQL. I'm using C# for the task.
I suggest you use an MS SQL Server foreign data wrapper on PostgreSQL, so you need no C# and have the full power of PostgreSQL’s SELECT… INTO.
Failing that, there is also DBI Links which gives you a subset of functionality and lower performance but still should be enough.
Now, if you just need to use C#… perhaps there is a PL/C# that you can leverage.
But, sincerely, this seems to me more to be about which syntax is allowed on C#. Perhaps you should ask in a Npgsql forum http://npgsql.projects.pgfoundry.org/?