Working with SQL Server (ADO)For more complex and robust applications we can also use SQL Server (different versions) as the database behind the application.
In the following examples we will see how you can connect, create, select and do more from within Visaul Basic to a database on SQL Server.
With SQL Server we can use stored procedures on the server to do something with the data which is stored in the database. This way we get the adventage of maintenance: we have all the code for selecting, inserting, deleteing etc of stored data on one central place. Changing code will not mean we have to go through the application and search for all the places we do a select (or insert,delete or what ever).
Stored procedures are also easy for executing multiple handlings on the database server. You can use transaction to control the executing of the query. With transactions you can get usefull (error) messages returned after the executing of a stored procedure.
You can also use cursors which are very powerfull tools. In the next examples we will get a closer look at stored procedures, transactions, cursors and all what is related to that.
Don't forget to add a reference to the Microsoft ADO 2.# in your Visual Basic project!