Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Intellisense in WPF Textbox

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.

like image 653
Zorro Avatar asked Jan 20 '26 02:01

Zorro


2 Answers

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.

like image 64
Lex Li Avatar answered Jan 21 '26 14:01

Lex Li


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!

like image 45
Alexander Avatar answered Jan 21 '26 14:01

Alexander



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!