Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 To display SQL Parsed String

Author  Topic 

rajender
Starting Member

13 Posts

Posted - 2005-06-30 : 03:29:51
Hi Team

I don't know whether it is right place to ask this question or not. I am developing a SQL-DMO application where i need to display SQL Scripts with reserved keywords in color like the Query Window of Sql Analyzer displays. I am using sqlparser.dll to parse the script into RTF format much like this

\cf1 CREATE\cf \cf1 TABLE\cf \cf5 [\cf \cf10 card_types\cf \cf5 ]\cf \cf5 (\cf
\par \cf5 [\cf \cf10 card_type_id\cf \cf5 ]\cf \cf5 [\cf \cf2 int\cf \cf5 ]\cf \cf1 IDENTITY\cf \cf5 (\cf \cf7 1\cf \cf5 ,\cf \cf7 1\cf \cf5 )\cf \cf5 NOT\cf \cf5 NULL\cf \cf5 ,\cf
\par \cf5 [\cf \cf1 name\cf \cf5 ]\cf \cf5 [\cf \cf2 varchar\cf \cf5 ]\cf \cf5 (\cf \cf7 50\cf \cf5 )\cf \cf1 COLLATE\cf \cf10 SQL_Latin1_General_CP1_CI_AS\cf \cf5 NOT\cf \cf5 NULL\cf \cf5 ,\cf
\par \cf1 PRIMARY\cf \cf1 KEY\cf \cf1 CLUSTERED\cf
\par \cf5 (\cf
\par \cf5 [\cf \cf10 card_type_id\cf \cf5 ]\cf
\par \cf5 )\cf \cf1 ON\cf \cf5 [\cf \cf1 PRIMARY\cf \cf5 ]\cf
\par \cf5 )\cf \cf1 ON\cf \cf5 [\cf \cf1 PRIMARY\cf \cf5 ]\cf
\par \cf1 GO\cf
\par
\par
\par


Now my problem is neither Textbox nor RichTextBox control is able to display it the way i want. I also tried word document thru VB code to display this text, but it displayed without color.

Can anybody know which control/component/library SQL Query Analyzer uses or is there any other control that i can use.

Thanks in advance.
Rajender Kr.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-30 : 07:09:57
This is presentation layer issue
If you use VB6 then, you can split the text and set the color accordingly
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = 10
RichTextBox1.SelColor = vbBlue

RichTextBox1.SelStart = 11
RichTextBox1.SelLength = 20
RichTextBox1.SelColor = vbRed

RichTextBox1.SelStart = Len(RichTextBox1.Text)

Something like that
Herafter, Post your question at relevent forum

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -