Problem using RichTextBox in CLR dll called from SQL Server SPL

  • Currently we have a DLL written that recieves text. This function looks at the text to see if it starts with the RTF tag and if so creates a RichTextBox, assigns the passed in text to the RichTextBox and returns the text value.

    Problem is we are recieving an error.

    We feel it's because we are using the RichTextBox which uses the System.Windows.Form.

    So does anyone know of any 3rd party RTF to Text libraries that are not windows forms? A .net dll that we can use.

    Joe

  • You are receiving that error because that library is not safe to use within the SQL Server hosted environment.

    Perform the conversion outside SQL Server.

  • It had to be unsafe because of the System.Windows.Forms and we can't do the conversion outside of SQL Server.

    Yesterday I spent the day writing our own RTFtoText utility in C# that was not dependent upon System.Windows.Forms

    The dll was also changed from UNSAFE to SAFE.

    I used regular Expressions and was able to remove the RTF tags and be return with the Text.

    Joe

  • joepacelli (3/9/2010)


    It had to be unsafe because of the System.Windows.Forms

    My point was that System.Windows.Forms is never safe for use in SQL Server. You can force it to, with UNSAFE and some trickery, but it is an extremely bad idea, as no doubt you realized.

    joepacelli (3/9/2010)


    and we can't do the conversion outside of SQL Server.

    I presume you mean 'we choose not to'...?

    joepacelli (3/9/2010)


    Yesterday I spent the day writing our own RTFtoText utility in C# that was not dependent upon System.Windows.Forms

    I would have downloaded one of the free ones on the Internet 😉

    SQL Server is still the wrong place to do bulk data conversion, even using CLR integration, IMO.

    Paul

  • Kuldip Rindani (3/10/2010)


    Below link can be helpful to you..

    http://nrtftree.soureforge.net

    http://www.sautinsoft.com/products/rtf-to-html/download.php

    I doubt it, since the problem is already solved. It might help someone else though, so thanks anyway.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply