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
2 comments
-
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 -
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()
Add comment
Please sign in to leave a comment.