--- uid: web-pages/overview/getting-started/introducing-aspnet-web-pages-2/entering-data title: "Introducing ASP.NET Web Pages - Entering Database Data by Using Forms | Microsoft Docs" author: tfitzmac description: "This tutorial shows you how to create an entry form and then enter the data that you get from the form into a database table when you use ASP.NET Web Pages (..." ms.author: aspnetcontent manager: wpickett ms.date: 05/28/2015 ms.topic: article ms.assetid: d37c93fc-25fd-4e94-8671-0d437beef206 ms.technology: dotnet-webpages ms.prod: .net-framework msc.legacyurl: /web-pages/overview/getting-started/introducing-aspnet-web-pages-2/entering-data msc.type: authoredcontent --- Introducing ASP.NET Web Pages - Entering Database Data by Using Forms ==================== by [Tom FitzMacken](https://github.com/tfitzmac) > This tutorial shows you how to create an entry form and then enter the data that you get from the form into a database table when you use ASP.NET Web Pages (Razor). It assumes you have completed the series through [Basics of HTML Forms in ASP.NET Web Pages](https://go.microsoft.com/fwlink/?LinkId=251581). > > What you'll learn: > > - More about how to process entry forms. > - How to add (insert) data in a database. > - How to make sure that users have entered a required value in a form (how to validate user input). > - How to display validation errors. > - How to jump to another page from the current page. > > > Features/technologies discussed: > > - The `Database.Execute` method. > - The SQL `Insert Into` statement > - The `Validation` helper. > - The `Response.Redirect` method. ## What You'll Build In the tutorial earlier that showed you how to create a database, you entered database data by editing the database directly in WebMatrix, working in the **Database** workspace. In most apps, that's not a practical way to put data into the database, though. So in this tutorial, you'll create a web-based interface that lets you or anyone enter data and save it to the database. You'll create a page where you can enter new movies. The page will contain an entry form that has fields (text boxes) where you can enter a movie title, genre, and year. The page will look like this page: !['Add Movie' page in browser](entering-data/_static/image1.png) The text boxes will be HTML `` elements that will look like this markup: `` ## Creating the Basic Entry Form Create a page named *AddMovie.cshtml*. Replace what's in the file with the following markup. Overwrite everything; you'll add a code block at the top shortly. [!code-cshtml[Main](entering-data/samples/sample1.cshtml)] This example shows typical HTML for creating a form. It uses `` elements for the text boxes and for the submit button. The captions for the text boxes are created by using standard `