April 2007 - Posts

The last few weeks I have spent a lot of time training junior developers and giving introduction courses into ASP.Net Web Development. One of the most powerful features of ASP.Net 2.0 is the ability to retrieve and view data from the database, make updates and inserts, and delete data without having to write any actual code. The power of this is nicely illustrated by the To Do List sample at ASP.Net AJAX.

Since I tend to repeat myself often lately when it comes to how to do this I decided to put together a little web application and post the source code and step here, showing how simply a new web application can be put together. I am going to use a simple example, we will be creating a Contact Manager to keep track of a list of names and telephone numbers. The tools you will need to complete this project with are freely available.

Step 1: Creating the Database

The first step in creating this application is to create the data store. We will be using Microsoft SQL Express as the database to store all the information we require. It's free for download although it does contain certain limitations. To create the database we will be using SQL Server Manager Express. At this point we will assume you already have successfully installed both on your machine and all the required links have been created.

1. Open SQL Server Manager Express - You should see a screen as follows:

Server Type refers to the type of SQL server I want to connect to. The default is adequate for our purpose.
Server Name refers to the machine I want to connect to. This can be either my machine name, (localhost) or . for our purposes
Authentication Method By default Windows Authentication should work fine alternatively select SQL Authentication
Username SQL Authentication Username
Password SQL Authentication Password

This connection dialogue is standard across all version of the Management Studio. It allows you to connect to any SQL Server and Service based on your selection. The authentication method depends on each installation of SQL Server. Windows Authentications indicates that your username and password you use to log onto your machine or domain will be used to log onto the server. You can also create SQL usernames and passwords, and choose SQL Authentication to use these to log on. Database access usernames or roles. SQL is extremely flexible in this regard.

 

2. With everything set to default you can just click connect at this point which should log you into the server on your local machine.

3. Firstly we need to create a new database to store all the relevant information in.

In the Object Explorer left click on the + next to your machine or server name.
Right click on the Database option to access the New Database option
Left click on the New Database option

A database is a collection of tables that is used to store information. There are various types of databases including MySQL, FirebirdSQL, Oracle apart from Microsoft SQL Server. Each table in a database consists of a set of columns that define the information to be stored within the table, and a number of rows containing the actual data. Databases provides powerful functionality, including the ability to index columns for speed, define unique keys for each row of data, ensures data integrity, central data management, data relationships  and more.

Microsoft SQL Databases can also contain views, stored procedures, functions and database diagrams. There is a strong security model included that allows for access control down to table level allowing permissions to be set to a user or role. This offers a various different ways to ensure data security and access. Data can also be imported and exported from other SQL database as well as Excel, CSV, Tab-Delimited Text files to name a few.

For people interested in learning more about SQL Server and possibly wanting to become Database Administrators have a look at the MCTS: SQL Server 2005 and MCTS: SQL Server 2005 Business Intelligence courses. Microsoft Certified Technology Specialist courses are focused on .Net Framework 2.0, Visual Studio 2005 and SQL Server 2005 and is internationally recognized.

 

 

 

 

4. Give the database an understandable name like ContactManager and click on OK.

5. Select the ContactManager Database under the Databases option in the Object Explorer by left clicking on the name and then left click the + next to it. During this series we will be working with:

Database Diagrams can be used to visually map the relationship between various tables. This can later be exported and also assist with the creation of foreign keys

Tables are the actual data stores for the database. A database can have as many tables as required by the application

Views are read only versions of tables, usually used to simplify complex queries or for reporting

Programmability contains all Stored Procedures and other code related options

And that is the end of Part 1. In an effort to keep the tutorials short and detailed I will be breaking focusing on core pieces of the process with each tutorial. If all goes well I will be able to post a part each day until we have our completed Contact Manager.

I went to collect the Microsoft Community Distribution CD's from the posts office this afternoon. The first batch consists of 3 CD's.

  • Microsoft Express Editions (1 X CD)
  • MCD February 2007 (1 X CD)
  • MCD April 2007 (1 X CD)

These CD's are distributed free of charge, and copies will be available at all future events. Should you be interested in a copy of these please Private Message me or e-mail me at severanc3 at gmail dot com. If you are able to supply your own CD's for copying these please indicate this in your query.

More information regarding MCD is available here.

The first exciting bit of Development news I have is that Telligent, the makers of Community Server, has released the next generations of their server software called Community Server 2007. The new version sports a new skinning mechanism called Chameleon, improved performance, new forum and blogging features as well as the normal bells and whistles associated with new ASP.Net applications. They have also brought out new licensing options, including an Express Edition with restricted features however it is still free. Find out more about the software here.

On the SA Developer front we have had brilliant responses to the KZN series of events held in the last few months, with a consistent average attendance rate of 15 people. I am excited by this and hope to expand the number of events soon, along with some talks with the Sponsors regarding some different and more involved events and socials. Five regular members of SA Developer was also promoted to Moderators, including myself. Congratulations to everyone involved. Since SA Developer is a non profit web site, with no income streams, everyone involved is giving there time free of charge, and it is great to see the response from so many different individual in ensuring the site grows and continues to provide information to the Developer community in South Africa.

Microsoft also recently launched the Community Distribution project which makes content and products available to communities who do not have access to huge bandwidth. These distributions are sent out to distribution points in various EU countries and then distributed to the public. I am glad to see so many local SA Developer members having offered up their time to act as a distribution point for this. More information about the program is available here with a list of distribution agents available here.

I went through my project list this morning and realised how many different projects I am involved in, and more importantly how wide the scope of these projects are. It is very rare for me to not be involved in multi projects at the same time, and this month is no different.

Asset Management System (AMS)

The AMS system I mentioned before. It is a 3-Tier application which allows companies to use PDT barcode scanners and RF Tags to keep track of all the company assets. The current architecture of this application makes it suitable for WAN and even Internet environments and it is utilised mainly by the motor industry in South Africa. Currently I am busy finalising the last module for this project for reporting. Reporting is being implemented using RDLC integrated into the WinForms client using the Microsoft Report Viewer.

This system has three distinctive parts. The first is the PDT application written for Pocket PC & Windows Mobile devices which provides the interface to the Barcode Scanner and the RF Bluetooth Scanners. The interface allows two modes, linking and counting. The linking mode allows barcodes to be scanned and then linked to a predefined list of assets extracted from any source, in most cases SAP. Various information about the asset can then be edited. Once the asset is linked to the barcode the asset can be counted in future audits. This application was written using C# on the .Net Compact Framework 1.1 and uses SQL Mobile Server 2.0 for database capabilities. Older technology was chosen due to a smaller size footprint and better backward compatibility.

The second part of this system consists of a WinForms client running on Windows XP. Using a RAPI wrapper module we developed in house the application is able to talk directly to the PDT devices using ActiveSync, allowing the system to rollout new versions of the client and manage the importing or exporting of data using XML flat files. Again a simple method of data transfer was chosen as it is tried and tested, and most client have 2 or more PDT's that need to be managed by the system.

The last part of this system is a .Net 2.0 Remoting service that allows the WinForms client to connect over the network. The remoting service manages all aspects  of the database communication, ensuring that no unnecessary database transactions occur over the network. The server runs as a Windows Service and allows connection through a configurable port to allow easy management via a firewall. Currently this system is installed and running at 4 clients, with marked improvement in performance both in the application and within the particular divisions using the new software.

Waste Management System (WMS)

The WMS system is a spin off from the AMS system. Using the same 3-Tier implementation the system allows the tracking of trolleys and locations for waste collection within plants. The changes to this application is the remoting service being replaced with a Windows Service and Web Interface. Currently the Technical Specification for this project is being developed for approval by client. The system will be implemented within the next 2-3 months and also utilised PDT's for data input, however will offer a simplified interface for dumb users.

Interwoven Connector Service (ICS)

The ICS projects is a web service that integrates into the Interwoven Document Management System. It allows external or custom application to interact with the DMS system to import, check in, check out and version documentation running through various other business flows or submission systems. The service allows management for which application can integrate and what level of integration each application has access to. This is a team project being jointly developed between the Durban division and Guateng divisions.

Apart from the actual projects I am involved in a also manage the KZN Chapter of SA Developer and do most of the major talks and events in the region. I seem to have a pretty busy work life at the moment but am satisfied with the challenges I am facing and the immense amount of learning that I am doing through these projects. I believe the industry I work in requires continues learning and challenges to allow for a productive working environment.

I had another successful SA Developer event at IT Intellect this evening. I had scheduled a talk called Dissecting a Web Application to cover the basics of a website, including a look at HTML and what a web application actually is. We had a nice turnout of 18 people, some of who are currently studying at IT Intellect. The feedback from the talk again seemed very positive and open up room for a few more talks, and I addressed some issues related to actual working problems. I am also impressed by how many people returned after the last talk in March, and we had 4 new people join this evening. We have 2 socials and 1 more discussion session coming up for April and I am hoping to keep the momentum going. We also had pizza and coke afterwards provided by one of the sponsors.

I do wish to extend my thanks to a few people who helped with tonight's event:

  • Bernard from IT Intellect for providing premises
  • Andrea and Werner from Carlyle Human Capital for providing the catering.
  • Michelle for general admin and organizing everything.