Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 3rd, 2006, 12:42 PM
Registered User
 
Join Date: Nov 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default SqlDataSource Deleting

I'm trying to delete each row in the database using the Deleting event. I have the following code, which is only deleting the first row. Any suggestions?

Thanks,
Carolyn

    protected void IWSSqlDataSource_Deleting(object sender, SqlDataSourceCommandEventArgs e)
    {
        foreach (SqlParameter param in e.Command.Parameters)
        {
            param.Value = "";
        }
    }



 
Old November 8th, 2006, 12:42 PM
Registered User
 
Join Date: Nov 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

protected void IWSSqlDataSource_Deleting(object sender, SqlDataSourceCommandEventArgs e)
    {
        e.Command.CommandText = "DELETE FROM [IWSMessages]";
    }

Call SqlDataSource.Delete and add the event Deleting to the DataSource.
Put that one line in there and all values are cleared from the table.

Enjoy!
Carolyn






Similar Threads
Thread Thread Starter Forum Replies Last Post
SQLDatasource cymerman ASP.NET 1.0 and 1.1 Basics 1 February 28th, 2008 12:38 AM
sqldatasource imjayakumar ASP.NET 2.0 Professional 3 May 21st, 2007 01:56 PM
sqldatasource imjayakumar Crystal Reports 0 May 19th, 2007 03:12 AM
sqldatasource imjayakumar ASP.NET 2.0 Professional 0 May 19th, 2007 02:58 AM
SQLDataSource bmains ASP.NET 2.0 Basics 1 December 19th, 2004 09:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.