November 7, 2008 at 11:56 am
Hi Lowell,
when i try to execute the function which you have given i am getting error
Msg 443, Level 16, State 14, Procedure RTF2TXT, Line 9
Invalid use of side-effecting or time-dependent operator in 'RAISERROR' within a function.
(
EXEC @hr = sp_OACreate 'RICHTEXT.RichtextCtrl', @object OUT
if @hr = 0 RAISERROR('Cannot Create RICHTEXT.RichtextCtrl, Not registered correctly, CreateObject Failed.',16,1)
)
however i have another machine having VS2005 and sql2005 and there i run your original function, but still that function is returning NULL.
required your help
November 21, 2008 at 4:13 am
Trying to use the rtf conversion function - not recognising the RICHTEXT.RichTextCtrl class:-
DECLARE @object int
EXEC @hr = sp_OACreate 'RICHTEXT.RichtextCtrl', @object OUT
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object
END
ODSOLE Extended Procedure error message is 'Invalid class string'
CLR Integration and OLE Automation are both enabled in Surface Area Configuration
and
SQL Server Service Restarted
Anyone any ideas?
Jonathan
November 21, 2008 at 5:25 am
most of the issues appear to be that the dll is not registered on the server.
'Invalid class string' implies that the control is not installed on the server...specifically that the registry entry does not exist for CREATEOBJECT to tie the class name to the specific classid and dll.
if you search the registry on the server, you should find RICHTEXT.RichtextCtrl
in multiple places: the specific classid/GUID could be different, depending ont he version installed...but it should have an entry. typically an entry gets created when you install something like a VB6 that uses the richtext controll, or when you manually run REGSVR32 dllpath\dllname.dll
here's what's on my computer, for example.
HKEY_CLASSES_ROOT\CLSID\{3B7C8860-D78F-101B-B9B5-04021C009402}\ProgID
HKEY_CLASSES_ROOT\RICHTEXT.RichtextCtrl
HKEY_CLASSES_ROOT\RICHTEXT.RichtextCtrl.1
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{3B7C8860-D78F-101B-B9B5-04021C009402}\ProgID
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\RICHTEXT.RichtextCtrl
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\RICHTEXT.RichtextCtrl.1
Lowell
November 21, 2008 at 6:37 am
Thanks for that - it's sort of what I thought and Regedit can't find RICHTEXT.RichtextCtrl anywhere.
My problem is that I don't what to do to install the class. I have a full VS2005 development configuration
with ASP.Net 2.0 and SQL Server 2005. Is the RICHTEXT.RichtextCtrl class not a standard element?
Jonathan
November 21, 2008 at 8:08 am
ugg...i had a long explanation, and it got lost when posted...rewriting it again here:
A version of the RichText control exists in All versions of .NET; it's under System.Windows.Forms.RichTextBox.
However, just because it exists in .net, doesn't mean it's automatically available to COM/CreateObject:
.NET is designed so it does not need to reference anything...it assumes that every dll or ocx it needs exists int he same folder as the calling executable.
This is why you can have multiple versions of the same application running side by side in .NET; each folder is self contained.
This is different from what VB6 expects; if you create a dll, it puts an entry int he registry, and one and only one version of that DLL can exist with that name.
That's what CreateObject does, looks for the unique name RICHTEXT.RichTextControl, finds the unique class id, which points to a specific path and dll.
You may have noticed that in .NET, one of the things you can do is expose your dll to COM...that does exactly the same as what vb6 does...creates a registry entry pointing to your dll. every time you build, it removes the entry in the registry and puts an updated version back.
So the .NET richtextbox is not directly exposed...you'd have to create your own dll that uses it, expose it to COM in order to use it with spOaCreate/CreateObject.
i had a different issue with spOaCreate method; whn i started passing really big RTF files, i was hitting a max number of characters to be passed back for the @in and @out variables...my RTF was getting truncated.
That's why i switched over to exposing a web service, or using an application to update a text column witht he rtf stripped values, as there's no limit artifically imposed due to parameter size;
if spOaCreate was updated to use varchar(max) for it's variables...that'd be ideal.
Lowell
November 21, 2008 at 9:13 am
Oh!
November 21, 2008 at 4:50 pm
till SQL 2000 it's ok with that control RICHTX32.OCX. But from SQL 2005
it simply doesn't work. I was looking for a solution which will be for
2000,2005 and Express as well. Obviously only one solution and which
will no need of installing thousand things.
I made a simple DLL in delphi to use it as for extended
procedure. This solution worked in all versions of SQL Servers and
no need of any further installation. Consider a typical case, a server with
SQL 2005 EXPRESS only.
Only limitation, it can accomodate only upto 8000 char size but I am
looking forward to make it usable for [varchar](max).
December 18, 2008 at 9:39 am
Has anyone had luck installing this on Windows2003 64bit/SQL 2005 64 bit?
I tried registering the RICHTX32.OCX and got no error, but when trying the
EXEC @hr = sp_OACreate 'RICHTEXT.RichtextCtrl', @object OUT
I get an error that it can't create it. This same works pefectly on any of my 32 bit servers.
The regex solution although viable is not good, because you can either miss some trimming or exceed in trimming.....
Ideas?
December 18, 2008 at 12:30 pm
go for the above steps
December 18, 2008 at 12:33 pm
December 20, 2008 at 4:46 am
following the above steps, create extended procedure using [c++/delphi/..], which will convert rtf to txt and then use it sql server..i m not in favoure of using 'richtx32.ocx' at all.
December 22, 2008 at 6:04 am
Well... and INSIDE that C++/Delphi code, how would you plan on stripping the RTF code? You still need to use either the RICHED32.OCX or the RichtextBox control in the System.Windows.Form assembly..... or how would you do it?
December 22, 2008 at 3:44 pm
yes, use the richtext box control to load the rtf and and then get the text value into normal text box, which will be the return value of the dll function. then u can use that dll into SQL server machine as extended SP, where no mater that control is registerd or not resgistered. I tested it in a server where only SQL Server 2005 Express version was installed and nothing else.
December 22, 2008 at 3:48 pm
Thank. Let me see if I can procure doing that. Hope that works on 64 bit.....
Although my web developer tells me he might have solved the issue on the web end trough a webcontrol, doing exactly that....
thanks for your input.
December 23, 2008 at 5:12 am
yes, web control way is correct also
Viewing 15 posts - 76 through 90 (of 105 total)
You must be logged in to reply to this topic. Login to reply