.NET
  Home arrow .NET arrow Page 7 - The Basics
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

The Basics
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 19
    2005-04-06

    Table of Contents:
  • The Basics
  • Modeling a Logon Process
  • Coding Conventions
  • Generating the VB .NET Code for the Logon Class
  • Generating the C# Code for the Logon Class
  • ER and ORM Diagrams
  • Generating the Database
  • Reverse Engineering a Database

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Basics - Generating the Database


    (Page 7 of 8 )

    Once you have your database model in place, it’s really very simple to have the physical database generated. However, you do need to know which type of database you want to create and where it’s located. Depending on the choice of database, you might also need to know the user ID and password for the database (hmm. . .user ID and password sound familiar). After you’ve selected the database type, you need to check the database model for problems that might prevent VEA from generating the database.

    In Exercise 1-13, you’ll generate the database model, and then check it for errors.

    EXERCISE 1-13

    1. Select Database -> Options -> Drivers. This brings up the Database Drivers dialog box, which shows all the installed ODBC drivers on your system.

    2. Select Microsoft Access from the list and click OK.

    3. Select Database -> Model -> Error Check.


    The Output window, which is now shown in the VEA workspace, displays the results of the error check, as shown in Figure 1-18. You can see that the logical validation went fine, but the physical validation didn’t. This means that VEA won’t be able to generate the Microsoft Access database, because there’s a problem with the ID column.


    Figure 1-18.  The Output window showing database model error-check messages

    In Figure 1-18, you can see that the physical validation against the Microsoft Access ODBC driver went wrong. The ID column has no precision specified. Wait a minute, didn’t you tell VEA to use the Row ID data type and not CHAR, as it now seems to be? You did, but this is one of the cases where VEA has a problem with the selected portable data type when it comes to generating it in the physical database. But you don’t need to worry, because if you know just a little about Microsoft Access, you also know that the physical data type you’re after is the AutoNumber one. This data type generates a unique number for each new row inserted into the table, starting with 1 and incrementing by one, by default.

    In Exercise 1-14, you will change the data type for the ID column.

    EXERCISE 1-14

    1. Open the Database Properties window by clicking the Database Properties tab at the bottom of the Visio workspace.

    2. Change the data type for the ID column to Counter (auto).

    3. Select Database -> Model -> Error Check.

    Now both the logical and physical validation against the Microsoft Access ODBC driver succeeds, as you can see from the Output window. Way to go! Now let’s get that database on the road. In Exercise 1-15, you’ll use the Generate Wizard to generate the database.

    EXERCISE 1-15

    1. Select Database -> Generate. This brings up the Generate Wizard, as shown in Figure 1-19.


    Figure 1-19.  The opening page of the Generate Wizard

       2.  Select the Generate new database option.

       3.  Click Next. Now the second page of the Generate Wizard
            displays, as shown in Figure 1-20. This is where you specify the
            type and physical location of the database.


    Figure 1-20.  The second page of the Generate Wizard

       4.  Make sure Microsoft Access is selected in the Installed Visio 
            drivers list.

       5.  Select the Create MDB file option.

       6.  Click the New button. The Create New Data Source dialog box
            appears.

       7.  Select the System Data Source option and click Next.6

       8.  Select Microsoft Access Driver from the list and click Next.

       9.  Click Finish. The ODBC Microsoft Access Setup dialog box is now
            shown.

      10.  Type Chapter 1 Database in the Data Source Name text box.

      11.  Click the Create button. This brings up the New Database dialog
             box, which is really nothing more than the well-known Save As
             dialog box.

      12.   Browse to the \EDWVSNETUMLMSF\Chapter 01 folder and type
             Database
    in the Database Name text box.

      13.   Click OK.

      14.   Click OK in the confirmation dialog box.

      15.   Click OK in the ODBC Microsoft Access Setup dialog box.

      16.   Click Next.

      17.   Click OK in the Connect Data Source dialog box, because you
              haven’t specified a user name or a password for the database.

      18.   Click Next on the database table review page.

      19.   Click Finish.


    After completing the exercise, you’re asked if you want to see the generated DDL script. Click Yes to open up the Visio Code Editor with the DDL script.

    In Figure 1-21, you can see the DDL script for the Microsoft Access database you just created. You don’t actually need the script, because the database was also created. However, it’s good practice to have a script for all database objects your application relies on, because it’s important to be able to re-create a database structure quickly in case of an emergency, such as if the database becomes corrupt and can’t be fixed. You might also want to have the DDL script for testing purposes.


    Figure 1-21.  The Visio Code Editor with the Microsoft Access DDL script

    If you have Microsoft Access 2000 or later installed on your system, you can open the database to see that the User table has been created with the columns specified and the correct data types.

    This article is excerpted from Enterprise Development with Visual Studio .NET, UML, and MSF by John Erik Hansen and Carsten Thomsen (Apress, 2004; ISBN 1590590422). Check it out at your favorite bookstore today. Buy this book now.

    More .NET Articles
    More By Apress Publishing


     

    .NET ARTICLES

    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT