September 30, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Visual Basic Database Tutorial - Part 7

  • November 19, 2002
  • By Karl Moore
  • Send Email »
  • More Articles »

If you've still got your Visual Basic 6 packaging, you may notice a huge son-of-a-gun green sticker on the box, proudly claiming "Includes Visual Database Tools".

And this isn't just another Department-of-Justice-type lie; Visual Basic really does include a few cool tools that let you mess around with databases within the development environment.

Microsoft created this groovy little feature to allow professional developers to alter the structure of major databases whilst remaining within VB so print out this section and take it to a machine, perhaps at work, where you can access SQL Server or one of the other database servers mentioned earlier.

If you only have Microsoft Access, you'll feel about as left out in this section as Pope John Paul in a French brothel.

So let's try it out. No, not the brothel, but rather more excitedly, the Visual Database tools:

  • Create a new Standard EXE project
  • Click the small 'Data View' icon on the toolbar

A popup window similar to the below should appear:

  • Hit the 'Add a New Data Link' button

We've seen the screen in front of you before, whilst connecting the ADO control to a database.

  • Select 'Microsoft OLE Provider for SQL Server' (or your database provider) from the list and click Next

If you don't have SQL Server or similar on your computer nor on any other network machine you should ignore all my SQL-specific comments and fill in the screen just as you did for the Access database in previous instalments. However be aware that you can't use these Visual Database tools to change the structure of an Access database only for editing data.

  • On the next screen, enter a server name plus any login details then select a database name

Your completed screen should look a little like this:

  • Hit that 'Test Connection' button and cross your fingers. It should report back that everything is A-OK
  • Click OK
  • You should now be in a position to christen the Data Link I've called mine Colossi, after the server to which it is linked
  • Click the little + beside your data link

The Data View window should now look something like this:

And from here you can do virtually anything with your database define relationships, create new tables, knock out a couple of views, write stored procedures or do a few other weird things we haven't yet covered simply by right-clicking one of the folders and selecting the 'New...' option.

Clicking the + sign next to a folder will show its contents. For example, expanding the Tables tree will display all tables within my CIS database. I can then edit the table structure, add information to the table or even delete the table just by right-clicking and selecting the appropriate option.

In this section, I've shown you how to use the Visual Database tools to link direct into a major database format. But each type has its own little quirks, so I shan't delve too far into this subject for fear of excluding virtually all of our readers except perhaps Crazy Jo of Mississippi and my technically au fait pet iguana, Strangely Brown.

[Ed: I remember him!]

But you now know how to access the Visual Database tools. And you'll probably need them as you progress onwards in the wacky world of enterprise development.

So how do you jump to those upper echelons of the nerd-world? Read on...





Page 3 of 5



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel