Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
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 March 26th, 2006, 03:02 AM
Registered User
 
Join Date: Mar 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error: Update requires a valid InsertCommand ...

I get this error message when I am trying to update multiple fields in my database:

Update requires a valid InsertCommand when passed DataRow collection with new rows.

This is my code:




Code:
' Finding the row i want to alter
For i = 0 To ds.Tables("table1").Rows.Count - 1
                    If ds.Tables("table1").Rows(i)(22).ToString = Request.QueryString("ID").ToString Then
                        For ii = 0 To 5
                            ds.Tables("table1").Rows(i)(ii) = "change"
                        Next
                    End If
                Next
                sqlCmd.UpdateCommand = New SqlCommand()
                sqlCmd.UpdateCommand.CommandText = "Update " & Session("table").ToString & " Set Date='" & dateMM.SelectedItem.Text & "/" & dateDD.SelectedItem.Text & "/" & dateYY.SelectedItem.Text & "',[Course Name]='" & CourseName.Text & "',Hole1='" & scoreinfo(0) & "',Hole2='" & scoreinfo(1) & "',Hole3='" & scoreinfo(2) & "',Hole4='" & scoreinfo(3) & " Where RoundID=" & Request.QueryString("ID").ToString
                sqlCmd.UpdateCommand.Connection = SqlConn
                sqlCmd.Update(ds, "table1")


Thanks In Advance,
Aldo


 
Old March 26th, 2006, 04:21 PM
Registered User
 
Join Date: Mar 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 So does anybody have a clue??

 
Old March 26th, 2006, 07:20 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

cross post
http://p2p.wrox.com/topic.asp?TOPIC_ID=41987

 
Old March 27th, 2006, 02:24 AM
Registered User
 
Join Date: Mar 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

so you would be more willing to tell on me for cross posting, but wont help me? WHY?!?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Not a valid password. (Error 3031) ybg1 Access 3 April 18th, 2008 04:33 AM
Error: Update requires a valid InsertCommand... spiffyaldo2 ASP.NET 1.0 and 1.1 Basics 0 March 25th, 2006 02:28 PM
Update requires a valid InsertCommand when ... spiffyaldo2 BOOK: Beginning ASP.NET 1.0 0 March 25th, 2006 03:05 AM
MySql .NET Provider Update/InsertCommand lifewarped ADO.NET 1 February 22nd, 2005 12:59 PM





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