Click here to Skip to main content
15,881,204 members
Articles / Programming Languages / C#
Article

.NET like Access(V1)

Rate me:
Please Sign up or sign in to vote.
3.20/5 (10 votes)
28 Feb 20067 min read 57.6K   542   40   4
Database library for rapid development.

(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.)

Snapshot

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:

  1. Build a form for each database table(s)/View(s).
  2. Lookup fields from other tables in case of foreign keys or any other relation.
  3. Navigate all records with nice customizable Navigator control.
  4. Build a menu to appear with each form with basic behavior (Last, Previous, Next, Last, Insert, Update, Save, Undo, Lock, Find, Sort,.. ) and with specific behavior.
  5. Bind shortcuts with user menu.
  6. Context menu with each Area (specially with Master detail forms) for navigation and basic actions.
  7. Filter screen with all searchable fields with friendly names (captions) with many combinations of criteria as possible.
  8. Sort screen with drag and drop facilities to put in order all the fields that you need to sort.
  9. Master Detail Form with all functionality of Automatic retrieving detail records and inserting Master Key in detail record with each Add or insertion.
  10. Find data screen with scrolling and highlighting data.

I PROMISE THAT YOU CAN DO ALL OF THAT WITHOUT ANY CODE, as long as you customize the library.

What is already Implemented in the DNetLibrary?

Actually I finished the navigation, and retrieving data, and programming all menus and shortcut functions.

I know you will be a little upset, but I will do my best to finish the rest of the functionalities as soon as possible.

But the good news is, if you understand how the library is created, you can very easily do the rest. And if you do, please email me to enhance the library.

What is the source of Information to let the library work?

Simply Typed Dataset is a copy of all tables and views in database with some meta data like Captions.

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

Absolutely not.

You still need the other tiers: Process Layer, Data Entity Layer, Business Object Layer, DALC Layer, Database Layer.

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

Image 2

The main classes in the library are:

  1. DataHelper class: that is the only class that will talk directly with the SQL database.
  2. Utilities classes: for formatting and other utilities, most of their methods are static.
  3. 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.
  4. 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:

  1. 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.
  2. 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

  1. Add a new inherited user control inherited from UC_Datawindow and name it UC_Job
  2. 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
  3. Click properties of UC_Job, then set DS_Data property as ds_Pubs, set Table as ds_pubs.jobs and set retrieveAtOpening = true.
  4. 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.

  5. 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
  6. Run the form Add new menu item in F_Main. Form menu calls Jobs and onclick add this code:

    C#
    private void m_Jobs_Click(object sender, System.EventArgs e)
    { 
    F_Job form=new F_Job(); form.MdiParent=this; form.Show(); 
    }

Image 3

Now enjoy the F_Job form and try to test all these options.

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.

History

  • V2 will include (God willing) Automatic Inserting, Updating, Saving, Sorting, Filtering
  • V3 will include Master detail form
  • V4 master record, details,... and Tree Support

I hope you enjoy the Application. If you have any comments and questions, mailto:wahib@iws-australasia.com

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.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) NSW Curriculum & Learning Innovation Centre
Australia Australia
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 innovation
www.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 Builder
And 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 much
And built library with PowerBuilder it was very useful for me and other developers

I have a wide experience due to my work in different companies
But 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 2004
I hope that you enjoy any Article I post.
God bless you.

Comments and Discussions

 
GeneralNewest Version Pin
aquilaii23-May-08 2:12
aquilaii23-May-08 2:12 
GeneralIt's so hard to read your article Pin
Alexandru Lungu6-Feb-07 4:54
professionalAlexandru Lungu6-Feb-07 4:54 
Generalgood work Pin
saber_solomon28-Feb-06 13:08
saber_solomon28-Feb-06 13:08 
GeneralRe: good work Pin
Refky Wahib28-Feb-06 15:15
Refky Wahib28-Feb-06 15:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.