3

I am building an application which contains Textbox. I want the Textbox to act just like SQl Server Editor with intellisense. I need help, can i make my Textbox act like a Sql Server Query Editor WITH Intellisense.

Zorro
  • 175
  • 1
  • 14

2 Answers2

4

What you want cannot be easily achieved on the fly. You have to prepare the following,

  • Syntax highlighting support so SQL statements can be displayed beautifully.
  • SQL parser, so that you can provide auto completion suggestions.

You might start from AvalonEdit which is an excellent control that help implement syntax highlighting,

http://www.codeproject.com/Articles/42490/Using-AvalonEdit-WPF-Text-Editor

https://github.com/icsharpcode/SharpDevelop/wiki/AvalonEdit

However, I think it is still your responsibility to write the SQL parser (as @Alexander suggested) and then integrate with AvalonEdit.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
2

Phil Factor worte an excellent blog post at SimpleTalk.com on how to parse SQL using Microsoft's SQLParser with PowerShell. At the top of the post, he has included a link to Dave Ballantyne's Cleaning Up SQL Server Deployment Scripts article, which explains how to obtain SQLParser & further work with it.

While not very specific, hopefully that will at least get you off in the right direction!

Alexander
  • 2,320
  • 2
  • 25
  • 33
  • I did it, I am going to make a Codeproject.com Article ,fully explaining how to do this. – Zorro Nov 10 '12 at 04:33
  • If you don't mind, please include a link to the finished article (probably best to submit & accept your own answer), so that anyone that comes across this in the future can easily find your solution. – Alexander Nov 10 '12 at 06:34