.NET like Access(V1)

(I apologize for missing files in the last zip file. If you downloaded this Application before March 1st 2006, please download again as this is the updated file. After downloading the file, please read readme.txt file and contact me at the article email if you have any questions.)</em />

Introduction

Every programmer has a big dream "Programming without code". Practically a lot of database tools offer programming without code, the best two tools that I tried are Microsoft Access and PowerBuilder.

If you developed applications using Microsoft Access, you will realize that developing with Access is not as easy as you thought it would be at first sight. After you use the wizard and are happy with the generated application, you will realize that you do not have a menu or MDI forms. In addition, you cannot do many trivial things unless you change the normal flow of Access, for instance if you want to create a dropdown combo box and fill it with a certain value in filter form, you cannot do so and it is obvious that you cannot make a true .exe Application.

Rapid Application seems very powerful as long as it is driven in the normal way, and is hard to customize.

Power builder was another tool. It is much more powerful than Microsoft Access INMHO but, if you use a readymade library you have to understand it completely, because any customization means you need to override a function with a new one.

So the conclusion is, if you use a powerful programming tool (like ASP.NET, .NET Windows Forms, Delphi, C++ Builder (that is what I used)) with a powerful programming library to inherit and use, and you know how to enhance and override functions, it is the best solution.

Now here you are, that is .NET as a Rapid database tool.

I implemented this idea earlier in PowerBuilder with three levels of inheritance. It took three months to develop and once I finished it, it spread out very quickly and many companies used it.

So I can easily apply the same concept in .NET Application.

Just create the library and you will inherit and use it, and it automatically works fine and is more powerful and easy than Microsoft Access.

What we Expect from DNetlibrary?

Is exactly what you expect from a database tool that cover all of these areas:

Build a form for each database table(s)/View(s).

Lookup fields from other tables in case of foreign keys or any other relation.

Does it mean that we will use a Great OOP Model to work as Data driven programming?

In many simple Applications, you need Just UI and DALC, and use Typed Dataset to represent Data Entity Layer.

In our case we will develop the UI Layer only, using a great feature of typed data set and data binding.

Structure of the library

The main classes in the library are:

DataHelper class: that is the only class that will talk directly with the SQL database.

Utilities classes: for formatting and other utilities, most of their methods are static.

UC_DataWindow: is the main class that applies all the UI features of the database tool including navigation, filtering, sorting, context menu, shortcut functions like menu, etc.

F_Single form: is the basic simple form for database form of single object, like employee information, all database lookup tables, detail table if the master is already filtered to be 1 record,.. It also works in the master detail model that uses 2 forms, first form has the master record and other contains the detailed records.

Using the code

To use the code, you simply do two separate steps:

Add new user control inherited from UC_DataWindow and add a typed dataset in this example DS_Pubs, then add datagrid or bounded text(s) combobox(es) and list(s) as you wish, and configure the properties of the user object.

Add a new form inherited from F_Single, then drag the userobject that you created and configure the properties of the form, then call this form from the main MDI form and you will enjoy all the functionalities.

Walkthrough create F_Job form

Add a new inherited user control inherited from UC_Datawindow and name it UC_Job

Add a new dataset from toolbox and choose typed dataset and choose DS_PUBS and name it ds_Pubs. So you have now got the empty user control that has the typed dataset ds_Pubs

Click properties of UC_Job, then set DS_Data property as ds_Pubs, set Table as ds_pubs.jobs and set retrieveAtOpening = true.

Add any data binding control(s). In this example add 4 text controls with 4 captions, add label and set the caption job_id then add textbox and set the name editjob_id and in databinding select the text and set with ds_Pubs - jobs.job_id.

Actually you can generate all the data textbox controls automatically if you add a temporary form using DataForm wizard and choose dataset DS_Pubs then choose Jobtable then choose single record / form.

Finally change the generated name of dataset to ds_Pubs then copy all labels and controls and paste it in the UC_Jobs, that is exactly what you achieved if you chose all labels and textboxes manually.

Create the new Inherited form F_Job from F_Single, then drag the UC_Job from toolbox to the Form and then set these properties. Show the Form Property and set the UC_DataWindowObject as uC_job1. Show the uc_Nav property and set UC_DataWindowMain as uC_job1

Run the form Add new menu item in F_Main. Form menu calls Jobs and onclick add this code:

Navigate from the navigator until you reach the last record, then click next. It will roll and begin from the start again and the text box indicator will show the number of current record / number of records.

Points of Interest

The F_job main menu will be embedded in the main menu, and still has its own context (pop up) menu.

If you tried with F9(First), F10(Next), F11(Prev), or F12(Last), you will realise the importance of inserting all the heavy code in the base class and inheriting all the functionality.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

Share

About the Author

I am a senior developer self taught, the main study is electronics and communication engineering

I am working as senior programmer in center for learning and innovationwww.cli.nsw.edu.au

I develop Software since 1995 using Delphi with Microsoft SQL Server

before 2000, I didn’t like Microsoft tools and did many projects using all database tools and other programming tools specially Borland C++ Builder, Delphi, Power BuilderAnd I loved Oracle database for its stability until I was certified as Master in Database Administration from Oracle University.

I tried to work in web programming but I felt that Java is hard and slow in programming, specially I love productivity.

I began worked with .Net since 2001 , and at the same time Microsoft SQL Server 7 was very stable so I switched all my way to Microsoft Tech.I really respect .Net Platform especially in web applications

I love database Applications too muchAnd built library with PowerBuilder it was very useful for me and other developers

I have a wide experience due to my work in different companiesBut the best experience I like in wireless applications, and web applications.The best Application I did in my life is Novartis Marketing System 1999 it takes 8 months developing with PowerBuilder and Borland C++, SQL Server Performance was the key challenge in this Application.The other 2 applications that I loved Multilingual Project in Scada company in Italy 2000 and SDP Mobile media content platform server for ChinaUnicom 2004I hope that you enjoy any Article I post.God bless you.

Thank you for your encouragementPlease once you try it and worked with itPlease ask me any question via my article email, if you are working with PowerBuilder and wanted the PowerLibrary Just send to meGod bless youRegards