|
One of the common needs of many corporate database centric ASP.Net applications
is to provide the ability to add, delete, and modify rows and columns in various database tables. Providing
this capability for a given table consists of dropping a datagrid or gridview control
onto a page, and connecting it to a datasource with add, update, insert, and delete
commands. (However the dataset designers in both
VS2003 and VS2005 have serious bugs when it comes to generating good update SQL
so the update SQL should be hand written.) Then creating a form containing all of the fields in the table with an
“Add New Record” button. The last task is to write
exception handling code.
Typically this is a job that takes the better part of a day to program and completely
test.
After doing this about ten times I decided to develop a utility that would
accomplish this for any table. Now when I have such a need, it’s a few minutes instead
of a few hours to accomplish the table maintenance function.
This is a demonstration of an ASCX control that facilitates maintenance of most any database table. Although it is tested only with SQL Server it is architected
to work with any database brand. It will soon be available for all of the commonly
used database brands.
You will notice that the optional bottom panel shows the generated SQL so this can
also be used as a SQL generator.
The coding required for a developer using this component to generate table maintenance
capability is very little.
The programmer simply has to pass a connection string, call an Initialization
method, and maybe pass an arraylist to constrain the table choices offered.
There are some limitations to this utility because it operates over HTTP
. It is intended mainly for maintenance of control tables and small
simple tables.
This demo rolls back all updates since it’s not wise to allow anonymous users on
this website to modify tables. This is one of the options of the program and is
usefull when testing a new page or using the utility to just show generated SQL.
|
|