GetString replacement

sobarowskisobarowski Posts: 3
edited October 24, 2016 9:51AM in SQL Compare 11
I am upgrading an old project to the Redgate DLLs version 11. The code calls ExecutionBlock.GetString, but that method is apparently no longer valid (even though the documentation says to use GetString() in place of ToString()). What should be done to replace the GetString function in the code?

Comments

  • Alex BAlex B Posts: 1,052 Diamond 4
    Hi sobarowski,

    According to the help CHM contained with the latest SQL Compare SDK release (11.6.11) you should use GetStream() instead:

    From the Compare SDK help:
    SQL Compare API 11.6.11
    ExecutionBlockExtensions..::.GetString Method

    Remarks
    If the ExecutionBlock contains a lot of SQL code, this method can cause virtual memory problems; you are recommended to use GetStream() instead.

    I hope this helps!

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • Thanks Alex,

    Right after I posted this, I figured out the GetStream() method, convert that to a string, and everything worked.

    Here's the code (VB) in case anyone needs it:

    Dim stream As Stream = block.GetStream()
    stream.Seek(0, SeekOrigin.Begin)
    Dim streamReader As StreamReader = New StreamReader(stream)
    Dim strBlock As String = streamReader.ReadToEnd()
Sign In or Register to comment.