Tag: C#

Dynamic SQL Merge statement builder through C#

Generating a merge statement dynamically can be a tedious job. This code help you create a SQL merge statement through C# dynamically at run-time.

  Usage

Output

Cannot close stream until all bytes are written – C#

This error is raised when the position of stream or memory stream object is set at the end of stream. To resolve the issue either you can set the position to “o” as shown below.

If this doesn’t work, you can re-create the memory stream as shown below