Saturday, September 6, 2008

Access Data Source .NET 2.x Through 3.5

Several ISP's support Microsoft SQL Server but many of them have capacity restrictions that do not allow for a robust data driven web application. Many of the ISP's that support MySql have similar restrictions. Those same ISP's do allow access to the Microsoft Access database management system. Of course the Microsoft access databases are unrestricted except to the extent of your available disk space. And with the advent of .NET 2.0 and higher access to the Microsoft Access database is greatly simplified by using the Access Data Source web control.

Simply stated the Access data source provides all the necessary communications to select, insert, update and delete information stored in Access databases by invoking the various SQL dialects available to the .NET platforms 2.x and higher. The target repository is a collection of datum that identifies members of an organization sometimes referred to as a member list. The balance of this article discusses the idiosyncrasies of the main properties of the Access Data Source web control and their utilization.

The DataFile property is as follows:

~/App_Data/me.mdb

This path to the database includes the root path from which it was executed plus a sub directory of App_Data and finally the Access database specification me.mdb.

The select command example is as follows:

SELECT * FROM [me] where uid = ?

This command selects a specific record in the collection that correspondent to the identified uid (user identification) from the [me] (membership entry) data table. Per the data definition of the table the uid (user identification) is an auto increment field.

The insert command example is as follows:

INSERT INTO [me] ([addr], [email], [fname], [ind], [lname], [phone], [pwd], [verf]) values (?, ?, ?, ?, ?, ?, ?, ?)

You will notice the name of the Access table is [me] the Members Entry data table as described minus the uid (user identification) auto increment field.

Parameters for the insert command are addr, email, fname, ind, lname, phone, pwd and verf. The parameters must represent the proper data type and the proper size for the associated data type. Their order must be in the exact sequence as they appear in the insert statement. Typically all parameters in the Access data source are positional.

The update command example is as follows:

UPDATE [me] set [addr] = ?, [email] = ?, [fname] = ?, [ind] = ?, [lname] = ?, [phone] = ?, [pwd] = ?, [verf] = ? where [uid] = ?

Parameters for the update command are addr, email, fname, ind, lname, phone, pwd and verf. The parameters must represent the proper data type and the proper size for the associated data type. Their order must be in the exact sequence as they appear in the update statement. Typically all parameters in the Access data source are positional.

The delete command is as follows:

DELETE * FROM [me] where [uid] = ?

There is one parameter for the delete command and it is uid (user identification).

This command will remove an entry from the data table that equals the uid specified by the uid parameter value.

The commands may be invoked by a .NET data aware web control such as DataGrid or DataList as well as other data aware control including user defined web controls. Also these commands may be invoked independently by using various features of the Access data source control itself.

Please feel free to visit my website by using the following URL. http://archbrooks.com

Arch Brooks, Software Engineer

Article Source: http://EzineArticles.com/?expert=Arch_Brooks

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home