Sei sulla pagina 1di 1

Creating Dynamic Data Entry User Interfaces - Nov.

22, 2004
===========================================================
To get started with the code sample in this download you will need to do first e
xtract the files in this ZIP archive to a directory on your computer and then do
the following:
(1) Create a database in SQL server and run the scripts in the SQL S
cripts folder. These SQL scripts create the tables, insert some "dummy" data, a
nd provide the stored procedures. (Please note: you'll need to use Microsoft SQ
L Server 7.0 or up, as the code relies on the Data Access Application Block 2.0,
which uses the SqlClient provider.)
(2) Create a virtual directory in IIS named DynamicControls that points
to the DynamicControls folder.
(3) Update the connectionString <appSettings> value in the Web.config fi
le to the connection string to your database. (See http://www.ConnectionStrings
.com for examples of connection strings for various data providers and data stor
es.)
You should then be able to open the VS.NET Solution by double-clicking on the so
lution file. (Note, this Solution was created w/VS.NET 2003; if you are using V
S.NET 2002, you will need to create a new Solution in VS.NET 2002 and add over t
he files manually.)
Some comments on the code:
* The code is meant to provide the concepts for implementing a dyn
amic data entry UI. The implementation details I chose can be changed on your e
nd (hopefully, very easily). For example, the backend could be moved to a diffe
rent data store. Or, as Dave Donaldson pointed out, the code specifying the UI
associations between customer type and question could be spelled out in XML cont
ent in the Web.config file.
* In the code I omitted error handling/checking. You'll note no Try/Cat
ch blocks, for instance. Typically, when I create Web applications I omit Try/C
atches from spots of code that I *cannot* recover from on the fly, and instead u
se ELMAH to handle logging of the error as well as notification of he system adm
inistrator. (For more on what ELMAH is and how to have it installed on your Web
site in under 5 minutes, see: http://tinyurl.com/47cp2)
* The stored procedures dq_MoveDownSortOrder and dq_MoveUpSortOrder real
ly ought to be wrapped up in a transaction. You could do this at the SQL level
or through code. I leave this as an exercise to the reader.

Enjoy!
Scott Mitchell
mitchell@4guysfromrolla.com
http://ScottOnWriting.NET

Potrebbero piacerti anche