Home > Articles > Programming > Windows Programming

Visual Basic .NET Database Tools

Begin creating projects, compile them, and run them with a new comfort level using Visual Studio's Integrated Development Environment. This book excerpt will also teach you about the IDE tools that can help you master database programming.
This chapter is from the book

Tools, tools, tools. It's funny, but if I were asked to name the one thing that has changed the most since the 1980s, as far as programming is concerned, I would have to say it is the tools available to the programmer. As far as the programming itself goes, we really aren't doing much more real work than we were 15 years ago. We're basically making screens, updating data, creating reports, and doing background (now called server-side) processing. Yes, it's a lot cheaper and a lot faster and a lot more complicated. In 1985, $40,000 got me a COBOL compiler for the Data General Minicomputer I programmed, and it was just that, a compiler. No editor (one came with the operating system), no IDE, no tools, just a command-line compiler and a bunch of thick books. No database tools either. If you wanted a database you had to shell out another $20,000 to $40,000, depending on the number of users. Moreover, all you got was indexed sequential access method (ISAM) which came with a database manager and some backup and integrity-checking utilities. There was also a very primitive query tool.

The first IDEs came with some of the MS-DOS PC-based software, such as dBase by Ashton-Tate and Boland's Paradox. I remember seeing my first real IDE in 1987 when I picked up a copy of Borland's Turbo-Pascal (which came on a single 5-inch diskette shrink-wrapped with the book). It had a color-coded editor (which I didn't even know about with my monochrome monitor), on-the-fly syntax checking, and built-in compiler. I was impressed. By the way, this is the tool that would evolve into Delphi a few years later. Even though I was impressed by the IDE, I could never quite swallow Pascal, with its weird block syntax.

It wasn't until VB 1.0 for Windows appeared that I felt that the IDE had finally found its stride. Since then it seems to be more about tools than programming. Originally intended to boost programmer productivity, the tools have become an entity unto themselves, causing programmers to spend more time learning the tools than the actual language. This has created a knowledge gap, where many of today's programmers are just tool users. I have read articles recently advocating dumping the IDE and returning to the simpler days of text editors and command lines. 1 I would not go that far, but I agree that the IDE can mask enough of the intricacies of programming that it can create a tendency toward laziness. However I also believe that the benefits of the IDE far outweigh the liabilities. Imagine trying to manage one of today's multimodule, multiproject solutions without an IDE with integrated source control. What a nightmare!

Some of my projects have literally hundreds of source files. The real-time syntax checking saves a lot of compile-edit-compile iterations. The dynamic online help is a lifesaver. Interactive debuggers have saved me thousands of hours scouring for bugs. This is not to mention the myriad other aids like spy++, the OLE tools, and so forth. Tools should enhance, not mask, a programmer's abilities. This is what the integrated database tools do in Visual Studio .NET. Without ever leaving the IDE, a programmer can create databases, tables, stored procedures, database diagrams, and views. In this chapter, we will look at the IDE and the tools provided to help with database programming.

A Roadmap of the IDE

With this version of Visual Studio, Microsoft finally achieved its goal of unifying the development environments into one IDE. Until this version, VB had its own IDE separate from the standard IDE used for C++ and other languages. One reason for this was because VB was an interpreted language while the others were compiled. Another reason was because VB developed along a separate evolutionary path than the other Microsoft development tools. The VB debugger was proprietary, but had an edit-and-continue feature that made C++ programmers jealous. There were many integrated tools, such as the database manager and data environment designer, that were not available in the other IDE.

The new IDE has some equivalents to the tools in the old IDE, but many have been combined into the Server Explorer, and some are made obsolete by the radical changes in VB itself. (See Figure 3.1.) Others have been incorporated into the various designers.

Figure 3.1Figure 3.1. The opening screen of the Visual Studio IDE.

Take a look at the IDE startup screen. Notice that nowhere does it say anything about VB. This is because the same IDE is now used for VB, C#, and C++, as well as any number of other third-party languages supported by .NET, including COBOL. By default, the Start page shows in the main workspace at startup. This is just an embedded web browser window. It doubles as the display for the online help, which is all in HTML now, and also as a portal to the various .NET web sites that Microsoft thought you might be interested in. I will leave it up to you to explore the pages. If you really hate this, you can turn it off through the Options dialogs. I initially turned it off, but I found some of the resources rather useful, and it is a quick way of opening your last project with a single mouse click, so I leave it on now. The IDE with a Windows application open is shown in Figure 3.2.

Figure 3.2Figure 3.2. The IDE with a new Windows application open.

VB 6—I don't know if you are one of these holdouts, like I was. In VB 6 and prior versions, the IDE supported a single-document interface (SDI) display mode. This was a holdover from the 16-bit Windows IDEs. In this mode most of the windows, including the designers, displayed as top-level floating windows, allowing the desktop to show through. Since I started with VB 1, I tended to prefer this mode to the newer multiple-document interface (MDI) style used in VB 5 and VB 6. The SDI mode is no longer supported, so we had best get used to the new tabbed view. If you can afford a larger monitor, use a high screen resolution, such as 1280x1024. Otherwise you will have to get used to scrolling the designers around if your forms cannot fit into the workspace.

The main workspace is the center of attention. This is where the various designers and code windows appear, surrounded by the many controls and tools available to you. The user interface (UI) uses a modified version of MDI layout called a tabbed view. All of the MDI child windows appear as tabs in the main workspace.

Two items of the IDE stand out: the Dynamic Help window, rollaway ancillary windows, and the solution explorer.

Dynamic Help takes F1 Help one-step further by automatically displaying all relevant Help topics each time the cursor is positioned over a keyword or a designer is open. I found this tool especially handy when first learning VB .NET and left it turned on because it did not slow down my typing, even on my slower laptop (300mhz PII).

Rollaway ancillary windows first appeared in the standard Microsoft IDE in a prior version. However, this is the first time the feature is available with VB so it is probably new to most of you. With the rollaway feature, some of the less frequently used windows roll out of the way and collapse into a tab when not needed, much like a window shade. When the user hovers the mouse pointer over the window's tab, the window rolls out. Most of the dockable windows have this option. It is enabled by clicking the pushpin icon.

In previous versions of VB the solution explorer was called the project explorer. It retains that function except that group projects are now called solutions. It also has a direct connection to the underlying file system. If you rename a file in VB, the IDE renames it on disk. If you delete a file from a project, it deletes it from disk. The good news is that it sends the file to the recycle bin so it can be recovered. If you want only to remove the file from the project, use the Remove From Project menu item instead. The solution explorer also allows you to act recursively on projects and solutions for things like source control functions. The solution now has properties that you can use to customize build types and other items.

The output window displays the results of program compiles. The task window displays compile-time errors that need to be fixed. These are linked directly to the source code windows so that when an error is fixed, it disappears from the task list. You can also jump directly to an error by double-clicking on the task. You can also use the task list to make notes to yourself, and so forth. This list persists between sessions.

If you have source code control, such as Visual SourceSafe, there is now a window that shows the status of all checked-out files. SourceSafe comes with the Enterprise Version of Visual Studio and higher. If you have SourceSafe Version 6.0 installed as a separate product, it will work with Visual Studio .NET Professional. A handy addition in this version is the inclusion of dynamic checkout. With this feature, if you attempt to edit a file that is checked-in, the environment will either prompt you for a checkout or silently check the file out, depending on your preferences. If you ever made substantial changes to a file only to discover that it was not checked out and somehow the read-only attribute got toggled off, you will appreciate this feature.

Working our way around, we come to the toolbox. The toolbox contains icons for Windows controls, database tools, and other components. It changes its contents based on the context. For example, if we are designing a web page, it will display the web controls. One annoying feature is that the Control tab doesn't show if you are in a code window. If you want to see what controls are available, you have to open a designer window first. I've seen more than one programmer mystified as to where all the controls went.

There are two main tools for managing databases in Visual Studio. Server Explorer allows you to create databases, manage tables and views, and create stored procedures and triggers. The database project allows you to manage scripts associated with the solution you are creating. With the database project you can create scripts to perform data definition language (DDL) and data manipulation language (DML) functions. DDLs are transact-SQL scripts that manage the database schema. DMLs are transact-SQL scripts that manage the data in the database. DDL and DML can be (and often are) combined in the same script.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020