Visual Basic database programming with SQL Server by example

Learn how to write to SQL Server using T-SQL commands from Visual Basic by developing a real life example application.
4.3 (4 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
27 students enrolled
Instructed by Neil Waring IT & Software / Other
$19
$40
52% off
Take This Course
  • Lectures 48
  • Length 3.5 hours
  • Skill Level Intermediate Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works

Discover

Find online courses made by experts from around the world.

Learn

Take your courses with you and learn anywhere, anytime.

Master

Learn and practice real-world skills and achieve your goals.

About This Course

Published 9/2016 English

Course Description

Learn how to create SQL Server databases and tables and create, update and read records directly from a Visual Basic project by building an example application from scratch.

.Net SQL Server developers are always in demand. Build a strong foundation in Visual Basic programming with SQL Server databases with this course.

Watch me create the application from scratch and code along with me.

Source code available for download.

This course is project based and you will build an example Helpdesk application by creating forms and writing code in Visual Basic and creating a database and tables in SQL Server Express using SQL Server Management Studio.

You Will Learn How To

  • Install SQL Server Express

  • Install Visual Studio Express

  • Create a Visual Basic project in Visual Studio

  • Create a SQL Server database in SQL Server Management Studio

  • Connect to the database in Visual Basic

  • Create tables in SQL Server

  • Create primary keys

  • Create forms in VB to add and update records

  • Add records to  SQL Server database from Visual Basic

  • Update records in  SQL Server database from Visual Basic

  • Use parameters to pass user data to SQL Server

  • Validate user data in Visual Basic

  • Handle errors in Visual Basic

  • Delete command in SQL Server

  • Display records from SQL Server in Visual Basic

  • Using one to many relationship in tables

  • Use SQL DISTINCT and MAX keywords in Visual Basic

  • Use SQL joins for returning records from linked tables

  • Create multipurpose forms in Visual Basic

  • Share code using modules in Visual Basic


No Risk – Money-Back Guarantee

Once you purchase the course, if for any reason you are not satisfied with the course, Udemy offers a 30-day money back guarantee.


What are the requirements?

  • You should be familiar with simple programming concepts, eg. variables loops etc. Some exposure to Visual Studio would be helpful, but not required.

What am I going to get from this course?

  • Build applications in Visual Basic to display,create and update records in SQL Server

What is the target audience?

  • Visual Basic/Visual Studio programmers who want to work with SQL Server

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.

Curriculum

Section 1: Welcome
01:52

A few words to describe the course, what we are going to learn, and some advice regarding how to get the most from the course. 

05:40

Downloading and installing SQL Server Express, walking through the various configuration screens. 

Downloading and installing Visual Studio Express which is very straight forward.

Section 2: Creating a database and connecting to it from Visual Studio
00:39

We'll go into SQL Server Management Studio and create the database we will use in our application.

06:00

We create a project in Visual Studio, add a button to a form and write code to build a connection string and connect to the database we created earlier.

Section 3: Adding people records to the system
02:04

Back into SQL Server Management Studio where we will create a table in our HelpDesk database to hold people details.

04:46

In Visual Studio we create a new form in our project and add controls to it for entering people details.

03:17

In this lecture we create a module in our project and learn how to share global variables and create routines that can be called from anywhere in the project

03:10

We learn how to create a query in SQL Server Management Studio to insert records into our people table.

03:50

In our project we learn how to pass an insert command to SQL Server directly from code connected to a button on a form, and to get back from SQL how many records were inserted.

03:35

In this lecture we take data entered into the form to use in the insert command. For safety we learn how to use parameters to pass the entered data to SQL Server.

05:22

We can now add records into our database from a form. In this lecture we make sure that data has been entered into the form before we try to add a record.

04:02

In this lecture we add error handling code around our insert statement, we need this for those (hopefully) rare occasions when we can't write the record, eg. we've lost connection to the server, or to the network. Rather than the program just crashing we need to deal with errors gracefully.

01:32

Now we have some people records in our table we want to return a list of departments from our people table, with each department only appearing once in the list. We go into Management Studio to see how we can do this.

07:53

We query SQL Server directly from code in our project to build a dropdown list of departments.

07:51

We query SQL Server directly from code in our project to display users on the main form.

03:24

The project loads our main form on startup so we add a right-click context menu to link to our people form

3 questions

Check your understanding so far

Section 4: Updating people records
07:12

We now want to allow people records to be updated, but rather than create a new form we'll utilise the add people form by adding code to enable it to have different functionality depending on whether we want to add a new record or update an existing record

02:21

We learn about the SQL update command in Management Studio.

05:26

In this lecture we create the code for updating records from Visual Studio

04:26

This is a brief discussion around SQL update and delete commands and how easy it is to do the wrong thing !

3 questions

Check your understanding

Section 5: Adding task records
02:34

We go into SQL Server Management Studio and create a table to hold task records

06:44

We create a form for entering task information in Visual Studio

04:14

In our Add task form we need to show a list of people to be able to select who has reported the task

05:27

We don't want to show technicians in the list of people so we need to add another parameter to our code for loading people.

02:58

SQL MAX

04:41

We use the SQL MAX command from Visual Studio code

05:29

How to call SQL insert command from Visual Basic

05:26

In this lecture we look at a different method for validating user input

3 questions

Check your understanding

Section 6: Displaying tasks on the main form
02:56

We now have tasks and people so we need to add another tab on our main form

02:09

Our people and task tables are related by the peopleid. In SQL Management Studio we build a query to return data from linked tables using SQL Join

05:38

In our project we run the Join command to return a list of tasks with people names

3 questions

Check your understanding

Section 7: Assigning tasks to technicians
06:49

In this lecture we create a new form to allow tasks to be assigned to technicians

02:55

In this lecture we display task data on the Assign form by accessing the main form from the Assign form

02:14

We want to display technicians only on the Assign form so we extend the versatility of some of our shared code even further

04:05

In this lecture we update the task record with the technician id

02:19

We now have two columns in the task table that relate to different records in the people table. We change our select statement for displaying tasks to now have two joins between the task table and people table.

06:00

We update our task display to show the name of the person reporting the task and the name of the technician the task is assigned to.

3 questions

Check your understanding

Section 8: Adding actions to tasks
01:30

We are going to record actions against tasks. There may be several actions for tasks so we create the Actions table to allow for this. This is a 'one to many' scenario. 

04:39

We need a form to allow the entry of actions, so we extend the logic in the Assign form to handle both assigning tasks and adding actions to tasks

09:22

In this lecture we insert records into the actions table

07:16

In this lecture we continue to extend the functionality of the Assign form by displaying existing actions for a task when adding an action

Section 9: Closing tasks
03:38

We now add the ability to close tasks by further extending the functionality of the Assign form to allow the status of a task to be set to Closed

04:05

We now have open and closed tasks. We add more context menu options to show All tasks, Closed tasks or Open tasks. We change the code for loading tasks to dynamically build a Where clause for a Select statement depending on which menu option has been chosen

06:40

In this lecture we add a create date column and a close date column to the task table and change the insert and update code to put data into these columns

05:17

In this lecture we add code to make sure that operations are carried out in a prescribed order, eg a task cannot have actions added if it has not been assigned

01:40

In this lecture I explain why there is no delete task option, and discuss consideratons for archiving tasks

06:22

In this lecture I discuss a couple of alternative options for generating sequential numbers for records

2 questions

Check your understanding

Section 10: Final words
00:29

Some final thoughts and a downloadable copy of the project

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Neil Waring, Systems Architect and Developer

Hello there, I’m Neil Waring and I have been working in software and systems development for over 30 years.

I have worked for a number of UK companies in that time, in various industries and using various technologies.

My career began with a training course in Cobol, and since then I have learnt to develop in Assembler, DataBasic,  Microsoft Basic, Visual Basic, Delphi, Asp.Net, HTML, CSS, JQuery and PHP.

I spent 15 years as the IT Manager of a multi million pound turnover business where, as the leader of a very small team, I developed and designed a  bespoke system written in Visual Basic and running on Microsoft SQL Server. I have spent the last couple of years being the designer and only developer of a system for a UK financial services company.

Throughout my career I have been constantly learning as technology has changed so much over that time. From desktop development to web development, even though there is a wealth of material available now, I always prefer training that shows how to use development tools to make real world applications.

I am now focussed on passing on the experience and skills I have acquired by producing project based training courses that teach how to build real world applications.

Ready to start learning?
Take This Course