Data Tier Application Development with VB.NET Part 2 - Using parameterized queries.

by Steve Ochani http://www.steveo.us

v 1.0 April 17th, 2008.

Purpose: To continue after Part 1 of the Data Tier tutorial to show how to use parameterized queries with VB.NET 2005 (Visual Basic .NET 2005.) To read Part 1 click here.

Intended audience: This tutorial is mainly intended for students that I help that are taking CMP 214 (Application Development with VB .NET) course at SUNY Nassau Community College but is still relevant to anyone wishing to develop a database application with VB.NET 2005. You should have at least basic knowledge and understanding of object oriented programming concepts and Visual Basic .NET 2005.

Structure of this document: This tutorial is split up into several pages each page containing text and thumbnails of screenshots of each step. You can click on the screenshot to see the full size screenshot.

Database note: This application will be accessing a database on SQL Server 2005. The table is a simple table called authors which has an ID (primary key and identity field), fname, lname and genre which are of type varchar.

 

This tutorial picks up right after the end of Part 1. For this tutorial you will make a new form that will enable you to search the table in the database on the last name of the author. So begin by creating a new form by right clicking your project in Solution Explorer, selecting Add and then Windows Form.

Name it appropriately such as frmAuthorSearch.vb

Now add a textbox, button and three labels that will show the result of the search which will be the first name, last name and genre. Again, name the components appropriately.

 

Page 2