Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97652 Viewers
80 Video lessons · 141103 Viewers
59 Video lessons · 59448 Viewers
52 Video lessons · 72766 Viewers
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.