Download PDF File Connecting an ASP.NET-form to a database. Connecting an ASP.NET form created with ExcelEverywhere to a database is very easy. We will do it in 3 steps: 1.
Connecting an ASP.NET-form to a database
Connecting an ASP.NET form created with ExcelEverywhere to a database is very easy. We will do it in 3 steps: 1. Calculate and save the form contents into a database. 2. Retrieve previous entered data from the database, show it in the form and let the user edit it and recalculated and save it again 3. Show all submitted entries so that we can click on them to edit them. Step 1 can be implemented in several other ways. You do not even need an ASP.NETpage for that, for example ExcelEverywhere for HTML + our advanced service or an external tool like Frontpage extension can be used for that. We are using Visual Studio 2003. If you do not have it, there are free or cheap alternative IDEs out there: Visual Web Developer 2005 Express Edition Beta, and ASP.NET Web Matrix. Actually, you do not even need an IDE, a text editor like notepad plus DOT.NET version 1.1 is enough. You can download all files in this example by clicking here. You need to use ExcelEverywhere for ASP&ASP.NET version 3.2.3 or later for this sample. 3.2.2 will not work.
Part 1: Saving a ASP.NET-form into a database
Part 1 is to save the entered data into a database. In part 1, the saved data cannot be accessed from the website. You have to access the database file directly to view the submitted data.
The starting point: the Excel spreadsheet
Todo: create a spreadsheet and name the input and output cells we want to store in the database. We started by creating a simple spreadsheet in Excel. It is a very simple and naive time reporting form. The user has to enter name, date, arrival time to work, and departure time. The spreadsheet calculates the number of hours at work. There are 4 input fields: 1. Name 2. Today 3. Arrival 4. Departure There is 2 output fields: 1. Hours, the number of hours worked 2. An error message fields which asks the user to arrive before he leaves. There is a 5th input field called serialno, which cab be ignored now. It is used in order to handle editing of already entered data.