Wrox Programmer Forums
|
BOOK: Professional ASP.NET 1.0, Special Edition/1.1
This is the forum to discuss the Wrox book Professional ASP.NET 1.1 by Alex Homer, Dave Sussman, Rob Howard, Brian Francis, Karli Watson, Richard Anderson; ISBN: 9780764558900
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 1.0, Special Edition/1.1 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 July 1st, 2004, 07:06 PM
Authorized User
 
Join Date: Sep 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cjcd
Default select - edit HELP PLEASE

I did the exercise on chapter seven for the selecting-editing-data, it worked fine.
However, I found myself in a situation where I need to apply this concept, so I used and modified the code as per my own need, surprise was that the code, once you click on a desired action says: "The SQL statement that would be executed is: xxxxxxx" amd so on, so it actually doesn't execute the code, rather it puts it on a label. What command should I use, or what should I place so it actually executes the command instead of telling me what the sql command would be...?

Thanks.

 
Old July 4th, 2004, 03:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

To execute a select statement, you would do:

mySQLDataAdapter = new SQLDataAdapter("proc, query, or table name", myConnection)
mySQLDataAdapter.SelectCommand.CommandType = CommandType.<appropriate type>
mySQLDataAdapter.Fill(myDataSet, "tableName")

To execute:

mySQLDataAdapter = new SQLDataAdapter()
mySQLDataAdapter.InsertCommand = new SQLCommand("proc, table, or query", myConnection)
mySQLDataAdapter.InsertCommand.CommandTYpe = <appropriate type>

myConnection.Open()
mySQLDataAdapter.InsertCommand.ExecuteNonQuery()
myConnection.Close()

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Select row in GridView WITHOUT using Select button rao965 ASP.NET 2.0 Professional 1 February 15th, 2008 10:44 AM
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM
Fill select box and select recordset value markd Classic ASP Databases 1 February 20th, 2006 06:41 PM
select="node1", select="node2"... Baldo XSLT 7 March 12th, 2004 10:38 AM





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