Database
SQL ServerImporting an Excel Spreadsheet Using Typed DataSets and TableAdapters: Creating a Data Access Layer (DAL)
Over the course of the past three tutorials we have created an ASP.NET page that allows the visitor to upload and display an Excel spreadsheet in a GridView. Our end goal is to allow the user to import the rows in the spreadsheet into the two tables of our application database, a task we will complete in this fourth installment.
In Displaying the Uploaded Excel Spreadsheet we saw how to use an
OleDbConnection to programmatically connect to the Excel spreadsheet and bind it to the GridView. Likewise, we could use this same style
of coding to insert data into our application database tables - connecting to the SQL Server database from code within the ASP.NET page
and issuing the INSERT statements. A better approach, however, is to design a tiered architecture that separates out the different
responsibilities into different layers. Specifically, we will place the code for inserting data into our database into a separate Data Access
Layer (DAL), which we will create using Typed DataSets.
With the DAL created, we can then wrap up the page's core functionality: connecting to the Excel spreadsheet, enumerating its rows, and using the DAL
to insert the rows into the database. Read on to learn more!
Read More >
Sponsored Links
Subscribe via RSS
SQL Server
- Naming Database Objects: Part II
- Trace Messages Part V: Trace Cleanup
- Naming Database Objects: Part I
- Multiple-Child Aggregation
- Creating SQL Tables for an Integrating Application Using Dexterity
- SQL Server 2005 Beta 2 Transact-SQL Enhancements
- .NET Rocks! - Brian Larson on SQL Server Reporting Services
- Computing the Trimmed Mean in SQL
- SQL Server 2000 Gains on Oracle
- Separator First Formatting (SFF)
