Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
This course investigates several key database-programming concepts: triggers, stored procedures, functions, and .NET CLR (Common Language Runtime) assemblies. Author Martin Guidry shows how to combine these techniques and create a high-quality database using Microsoft SQL Server 2012. The course also covers real-world uses of the INSERT, UPDATE, and DELETE procedures, and how to build a basic web form to connect to your database.
The next thing we'd like to do is create a connection between our web application and our database. We'll do this, off of a window called Database Explorer. Inside of Database Explorer the top option is Data Connections. We can right click that and say Add Connection. Up here you'll need to give it the name of your SQL Server, or the IP address. There's mine. We have the option to use Windows authentication or SQL authentication. I'm going to stick with Windows and we'll need to choose which database we're interested in.
My database that we were working on in previous examples. Hit Test Connection. It says Succeeded and that's good. And now we see a new connection named Thusly, basically it's the name of our server.name of the database. going to open that up and explore it, we see the tables we were working with previously, and we also see the store procedures we worked with previously, and the functions we worked with previously. So we are very close to being able to run these store procedures off of the web page.
Now let's look at assembling some of the pieces we're going to use to create our web application that will communicate with our SQL server store procedures. Here in Visual Web Developer, I'm going to create a new website. I'd like to use the template a C# template for an ASP.NET Empty website. I'd like to drop that in our Exercise folder, and we'll call it the AuthorsSite. So this gives me an empty solution with no data in there.
I'd like to add a basic web form. So I'll right-click and say, Add New Item. I'd like to add a web form and I'd like to call that web form Author's Page. The machine will write some code for me, but that I'm not going to use that. I've already written some code that should be in the exercise files. Looking at the code real quick, we have some styles that we're setting up. Two styles, one for the headings and one for the body and then we have a table that's creating a space for a list of all active authors, and another space for us to create a form to insert new authors.
We flip over to Design View, we can see this, our two headings and two empty spaces available and ready for us to put exciting stuff in there. Now, I'd like to bring this home with something a little more practical. Obviously, users won't go directly to the database, to update and insert records. More likely, they would go to an application, or a website, to manipulate the records in our database. So I'm going to go ahead and create a small web application that connects to our database. It'll use some store procedures and functions.
And we'll see that if we take some time and effort to set up our store procedures and functions correctly, then the level of effort and the amount of code we have to write on the website is very easy.
There are currently no FAQs about SQL Server: Triggers, Stored Procedures, and Functions.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.