Database
  Home arrow Database arrow Page 2 - Database Storage with the ASP.NET Web Matr...
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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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? 
DATABASE

Database Storage with the ASP.NET Web Matrix
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    2005-09-14

    Table of Contents:
  • Database Storage with the ASP.NET Web Matrix
  • Create a database and table
  • Setting up a registration page
  • Coding the page
  • Error message
  • Password security

  • 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


    Database Storage with the ASP.NET Web Matrix - Create a database and table


    (Page 2 of 6 )

    First then, you can create the database and table that will store the usernames and passwords of your visitors.  To do this, click on the Data tab on the right-hand side of the application and select the Add Database Connection button.  This will open the Add New Project dialogue box, where you can select the SQL Server database.  In the Connect to Database dialog box, click the link at the bottom entitled Create a new database.  You’ll be prompted to choose a name for the new database, so enter something relevant, like "members."  The connection will now show in the Data panel.

     

    To add a table to the database, in which to actually store the information, expand the new connection and highlight the tables folder.  Click the New Database Object button and enter a name for the table.  Again, use a name that makes sense, such as "logins."  The table interface will now be displayed.  We’ll keep it basic for this exercise and just create two columns -- one to store the usernames, and one to store the associated passwords.  The first column has been created for you; highlight it and click into the Name field.  Enter Username and then click into the DataType field.  A pointer will appear, allowing you to expand the selection.  Choose char.  Now click into the Size field and set a limit of 20 characters.  Finally, scroll down to the bottom and set the IsUniqueKey option to true, specifying that the table cannot contain duplicate Usernames.

    Click the New button to add another column, set the Name to Password and set the rest of the properties as above.

     

    Click the cross button in the top right-hand corner of the table interface to close the window.  You will get a message advising that no primary key has been set, but choose to save the table anyway.  This means that you will not be able to edit the data in the table, but for this basic example, you don’t need to.  Your new table will now appear under the tables folder of the database connection.

     

    More Database Articles
    More By Dan Wellman


       · Hi,This article explores the first of the built in Code Wizards that allow you...
     

    DATABASE ARTICLES

    - Manage Projects with SQL Server Management S...
    - Query Editing and Regular Expressions with S...
    - Using SQL Server Management Studio Tools
    - SQL Server Management Studio
    - Exporting a MySQL Database to Excel Using OD...
    - Controlling Databases with SQL Server 2005 D...
    - Using Recovery Models with SQL Server 2005 D...
    - Handling Database Properties for the SQL Ser...
    - Managing Permissions with the SQL Server 200...
    - SQL Server 2005 Database Engine Security
    - Administering SQL Server 2005 Database Engine
    - Building Applications with Anonymous Types
    - A Closer Look at Anonymous Types
    - Programming with Anonymous Types
    - Converting Your Excel Worksheet into a Worki...





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek