Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 25th, 2006, 02:28 PM
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






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 2.0 Basics 3 March 27th, 2006 02:24 AM
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.