Try to create a Union query by MS Access, or an Update one, or an Insert one………..
If you wanted to see (or edit) the Sql query, What if the query a little bit long ………
The editor there sucks …………yes it does.
The Font Size doesn't change …Key words don't get colored….,
Sometimes Tables names are hard to remember, you have to memorize Tables/Queries/Columns names (or go to their places to copy and paste)
I think what mentioned has enough reasons to make me get sick with that editor and make my own one………
Any way…It's a Windows Application, developed on VB.Net 2008 IDE,
A very productive, easy to use tool to edit your Sql Queries.
We're gonna see advantages through this little tutorial.
you'll see your query well colored, it's more readable so, even more, you can change the colored to your preferences, and it will save your preferences for next times.
It provides a grid for you to enter Parameters Names and Values to use in Parameterized Queries.
It provides auto completion when you press (Ctrl + Space),auto complete list contains every thing you could use in your query (Tables names , Queries names, Columns names, Functions names , Parameters names),If you started to write some word, and pressed (Ctrl + Space) the auto complete list is gonna get filtered so it contains only words that start with the part of word you have already entered, Then you can choose what you like from the list by one of the three available ways (mouse Double Clicking it , pressing Space while it's selected , or pressing Enter while it's selected),
when you Choose your target from the list it will replace the part of the word you have already entered.
Any time you wanted not to use the already shown auto complete list you can just press ESC, or mouse click out of it,
(We'll talk later about technical treatments).
I know ………I know ………MS Access Queries don't support commenting.What if the user is trying to make up his/her mind, user didn't exactly know what to write (yet), he/she is bringing info from some source, and needs to execute some part of it,
user is gonna be a programmer any way, and he/she's got to know that he/she won't be able to use query the way it is in the Editor here.
and so for "Executing Selected Part",I think no need to say more for this, all user has to do is to Select some part of the written text in the Editor and Execute,
Any way, you can make a "Single Line Comment" by preceding it by a double Dash --or a "Multi Line Comment" by preceding it by this /* and following it by this */ (just surround it by these /* */ for god sakes)
It provides a nice tool that converts the query statement into code can be used in either languages VB.Net or C#.
That nice idea was inspired from a great man (and most of its code is written by him), who has enlightened me by his books and Blogs, he is Turki Al-asiri
it provides three manners to export the grid-output to Excel Sheet.I know one manner is enough, but I wanted this tool to be Educational to you more than being commercial or helping tool, so you'll see three manners to export data to Excel Sheet (and there are more)
just discover the Menus and their shortcuts.And the DB Objects Context Menus
I'm so sorry to say that when it comes to the big data (very big data ) it's not gonna be a good result, It's gonna get un-predictable, it could take a long time to end (very long time :Minutes), or it could BREAK DOWN (god forbidden)
It's a technical thing, It got lazy because of the operations that have been done to make later usage Faster (like Filling the Tree, DB objects Auto complete list …..etc)
For now I think I'm gonna leave it this way……….may be in future I could make a more tight Coloring Algorithm (I'm so sorry, I can't do it now, I'm too busy for next 5-6 months……..maybe),
You're gonna ask me a question,How long does it have to be to feel the slowing?
I'm gonna put them as screen shots,I think what mentioned before gives a plenty of Illustrations, so no need for more comments:
Example 1:
Example 2:
Example 3:
connect to the Northwind.mdb sample databaseconsider you tried to write the next statement
Select [CategoryName] From [Categories]
And for some reason you wanted to change the Selected Column
From [CategoryName] to [CategoryID]you would try to delete the end of it and try to use the Auto Completion utility, like this
Select [Category From [Categories]
Now you pressed the (Ctrl + Space) and you had the Auto Completion list opened, ... You selected the Column you need and pressed (Enter) ,………Surprise ………………..You got this
Select [[CategoryID] From [Categories]
Auto Completion utility takes the word to complete without
Non-Word characters (Brackets, Commas, Dollar Sign, Asterisks ……………etc).
Not cool, but you need to take it into considerations.
The reason behind the lazy coloring is that the tool (RichTextBox) used to color words tries to color All Text every time the text in the tool changes,…….that takes time,………….
I tried to make another algorithm that colors the only current affected line, it still slow,
I tried to make another algorithm that colors the only current affected word, it still slow,
I think we have to think about it later
this tool uses three manners to export the data to Excel, I mentioned before that I want this tool to be Educational to you,
Ironically Excel 2003 recognizes formats more than Excel 2007 (of course Excel 2007 does recognizes them but not in its own extension "*.xlsx", it recognizes them in "*.xls" extension)
you see, if you write an HTML-Table file and save it as "*.xls"Excel 2003 will recognize it , but Excel 2007 won't with the "*.xlsx" extension ,but will with "*.xls" extension
if you write an XML file (in special Format) and save it as "*.xls" Excel 2003 will recognize it ,but Excel 2007 won't with the "*.xlsx" extension ,but will with "*.xls" extension
[ To learn about this XML special-Format, open Excel 2003, create your sheet, format it by Excel, then in the [Save As] dialog choose the "XML SpreadSheet", save it , and then open it with Notepad, it's very comprehensible.]
[ the code used in XML creation is a Remixed Version of an C# Function written by Xodiak in an article he made here in codeproject from here, I converted it to VB.Net and re-organized it the way I like it to be]
one more manner (but we didn't used),if you write a Tab-Separated file and save it as "*.xls" Excel 2003 will recognize it , but Excel 2007 won't with the "*.xlsx" extension ,but will with "*.xls" extension
The last manner used is to use the Excel Application to do the job, it requires the user to have the Excel installed,and it's the most slow manner among the mentioned manners
I hope you get a great information and ideas in this tool, so it helps you in other applications you create
you're gonna find a copy of the article in the attached zip file , in the project resources , or you can get it from the help menu of the app
Happy Querying.
This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)
General News Suggestion Question Bug Answer Joke Rant Admin
Math Primers for Programmers