E
Elmo
I've got a situation where I'm trying to fix an existing table - - The Fname
Field has both First & Last Names...
So - I've populated a Dataset with the ID, First and Last names - - -
I'm iterating through the datatable, Fixing the datat and assigning the
First and Last name to variables, which I then, want to use to update the
first and last name fields with.
I keep getting an error when I try to do the Update on the row:
"Update requires a valid UpdateCommand when passed DataRow collection with
modified rows. "
So far, here's what I've got :
For Each MyRow in ds.Tables(0).Rows
'Manipulate the data here - - asign First to sFirst and Last to sLast
variables (working perfectly)
'I then populate the update command:
UpDateSQL="Update Registered set Fname = '" & sFirst & "', Lname='" & sLast
& "' where ID = " & iID
Dim upDateCmd as New SqlCommand(UpdateSQL, MyConn)
UpdateCmd.CommandText=UpDateSQL
Trace.Warn ("commandText = " & UpdateCmd.CommandText) <---- this shows up
perfectly - exactly what is needed to update the table
da.Update(ds, "Registered") <-- error occurs here
What's wrong here?
Apparently I'm missing something, but I don't have the slightest idea what
it is.
Field has both First & Last Names...
So - I've populated a Dataset with the ID, First and Last names - - -
I'm iterating through the datatable, Fixing the datat and assigning the
First and Last name to variables, which I then, want to use to update the
first and last name fields with.
I keep getting an error when I try to do the Update on the row:
"Update requires a valid UpdateCommand when passed DataRow collection with
modified rows. "
So far, here's what I've got :
For Each MyRow in ds.Tables(0).Rows
'Manipulate the data here - - asign First to sFirst and Last to sLast
variables (working perfectly)
'I then populate the update command:
UpDateSQL="Update Registered set Fname = '" & sFirst & "', Lname='" & sLast
& "' where ID = " & iID
Dim upDateCmd as New SqlCommand(UpdateSQL, MyConn)
UpdateCmd.CommandText=UpDateSQL
Trace.Warn ("commandText = " & UpdateCmd.CommandText) <---- this shows up
perfectly - exactly what is needed to update the table
da.Update(ds, "Registered") <-- error occurs here
What's wrong here?
Apparently I'm missing something, but I don't have the slightest idea what
it is.