ASP.NET
  Home arrow ASP.NET arrow More Ways to Update Databases using ASP.NE...
Iron Speed
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 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
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? 
ASP.NET

More Ways to Update Databases using ASP.NET 2.0 SqlDataSource
By: Michael Youssef
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 6
    2007-11-06

    Table of Contents:
  • More Ways to Update Databases using ASP.NET 2.0 SqlDataSource
  • Using a ListBox and a SqlDataSource control for Default.aspx page
  • Using a SqlDataSource control in the Default2.aspx page
  • Testing the Example
  • Using the QueryStringParameter and the ControlParameter

  • 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

    At the virtual BlackBerry Technical Seminar 2008, you can ask your development questions directly of Research In Motion® (RIM) experts, and take advantage of learning opportunities designed uniquely for BlackBerry solution developers. Register Today!

    More Ways to Update Databases using ASP.NET 2.0 SqlDataSource


    (Page 1 of 5 )

    In the previous article, we saw how to insert a new record using the SqlDataSource control, programmatically, by assigning appropriate values for the SqlDataSource.InsertCommand property, SqlDataSoruce.InsertParameters collection property and calling the SqlDataSource.Insert() method. Today we will write code to update the Northwind's Employees table and provide the delete functionality.

    Note that in this article we explain the basics so when we discuss how the Data-Bound Controls work with the SqlDataSource control you wouldn't feel lost. If you have used the Visual Studio.NET 2005 Task Menu feature, for a SqlDataSource Control as we did in the article "Introduction to the ASP.NET 2.0 SqlDataSource Control," you may have noticed that it generates the SELECT, INSERT, UPDATE and DELETE statements for the SqlDataSource control that is set as the Data Source for the GridView.

    Those statements may be parameterized queries too, so where do the values of the parameters come from? And in what syntax? What are the default names for the parameters? All of these questions will be answered when we discuss the Data-Bound Controls. But today we discuss the basic concepts of updating and deleting data in databases using the SqlDataSource control. So let's start with our code example.

    We are going to have two pages for this example. The first web page is going to use a SqlDataSource control (declaratively) to retrieve data from the Employees table into a ListBox control. The second page will be used to update a record in the Employees table. 

    Usually you will use a Data-Bound Control to perform the Update, Delete and Insert operations, but in this article we write the code without using a Data-Bound Control. So let's begin developing the first page.

    More ASP.NET Articles
    More By Michael Youssef


     

    ASP.NET ARTICLES

    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...
    - Completing an ASP.NET AJAX Server-Centric Ba...
    - Information Management for an ASP.NET AJAX S...
    - Comment and Order Management for an ASP.NET ...
    - Back-end Management Tasks for an ASP.NET AJA...
    - User Information Management for an ASP.NET A...
    - Adding Comments and Search to an ASP.NET AJA...
    - Order-Related Modules for an ASP.NET AJAX Se...
    - User and Role Management for an ASP.NET AJAX...
    - Programming an ASP.NET AJAX Server-Centric B...

    SunQuest




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway