Stored Procedures

Introduction

This is a sample chapter from Beginning Visual Basic SQL Server 7

In Chapter 5 we used SQL statements to insert, select, update, and delete data, and in the last chapter we used SQL statements to select data from the State_T table. While the use of in-line SQL statements is great for ad-hoc queries, they are not generally used in production applications. They do, however, have their place in production applications where dynamic SQL statements are to be built and executed. Dynamic SQL statements are SQL statements that are built in your VB code, thus they are generated dynamically at run-time. You typically use If.. Else.. EndIf statements to build the SQL statements needed to retrieve the data that the user has requested. For the most part stored procedures are used, and provide many benefits over in-line Transact-SQL statements.

This chapter explores stored procedures and demonstrates some of the basic tasks that can be accomplished with them. We will take a look at stored procedure parameters and see how they can be used to build robust stored procedures. All of the stored procedures created in this chapter will be executed in a VB front-end program that we will create.

In this chapter we will examine:

  • Stored procedure performance
  • Input and output parameters and the return value
  • Stored procedures that select, insert, update, and delete data
  • You might also like...

    Comments

    Contribute

    Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

    Our tools

    We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

    “We better hurry up and start coding, there are going to be a lot of bugs to fix.”