Creating a Database Project in VS 2005 - The Query Editor (Page 4 of 4 )
The Query Editor has four panes. The default view shows all the panes to the user. If you right click on an empty area in any pane you will bring up a context-sensitive drop-down where several types of actions may be performed. For example the next screen shows the various panes from one such drop-down. The four panes are Diagram, Criteria, SQL, and Results.
In the diagram pane you will be bringing in the tables and establishing relationships that you may want to be included in the query. You may also choose the columns from the tables to be included in the query results.
In the criteria pane you will be arranging for the sorting of the columns and their order, the visibility or otherwise of the columns that are included in the query, and any criteria that each of the columns need to satisfy. In the present example neither sorting (other than default) nor criteria were applied.
In the SQL pane you may verify the SQL syntax, and you can make changes to the SQL statement for testing what if scenarios, before you make a final decision.
The results pane will show the result of the query in a tabulated view. It also shows how many rows were returned by the query. You also have the option of navigating through the results using Next, Previous, First and Last arrows.

In this drop-down you may also change the type of query (currently it is a Select query) you want as shown in the next picture. The various choices that are supported by the provider are shown.

You will see that in the SQL Pane you can verify as well as execute the SQL statement in view in that pane. In any of the panes you may execute the query. Additionally you also have a menu bar for some of the the database related activities as shown.

Running the query and viewing results
You may now execute the query from any of the panes, or from the menu bar at the editor. You will see the results as shown in the next picture. This query yielded 2155 rows of data with the first few rows in view.

You may now save the query by going to File-->Savequeriesdetails.dtq or Ctrl+S as shown in the next picture. You may also save it under another name.

If you now highlight the details.dtq query in the project explorer you can also see its properties as shown in the next picture. It shows the Query Editor-related information such as whether all columns were included, any parameters used, or any distinct value sought, and so forth.

Summary
This tutorial described the steps involved in creating a database project using the templates available in the Visual Studio 2005 IDE. The database project describes connecting to a networked Microsoft Access database and designing and evaluating the query which may be consumed by any other application created using the IDE.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |