G
guzman.dan
I have tried everything I can find on the internet, and I keep getting
the same error message:
"Update requires a valid UpdateCommand when passed DataRow collection
with modified rows."
Here is the simplest iteration of the code that generates the error.
I've tried the commandbuilder, and that doesn't work either.
Essentially, I'm grabing a table with only one record in it and
changing some of the values. Thats it. Why doesn't it work?!?!?!?!
Thanks
Dim AdaptSql As OleDb.OleDbDataAdapter ' adapter is use to
update the dataset and datasource
Dim DatComps As DataSet
DatComps = New DataSet
AdaptSql = New OleDb.OleDbDataAdapter("SELECT ComputerName,
PERSON, EPAID, ROOM, BUILDING, PCIMAGE, SERIAL FROM(Inventory) WHERE
ComputerName='" & strComputer & "' AND EPAIS Is NULL", conADT)
AdaptSql.Fill(DatComps, "Computers")
Dim drEditrow As DataRow
drEditrow = DatComps.Tables("Computers").Rows(0)
drEditrow.BeginEdit()
For Each objItem In objEnvironment
Select Case objItem.NAme.ToString
Case "#ID"
drEditrow("EPAID") = "R4T678"
Case "#Room"
drEditrow("ROOM") = "A123"
Case "#Building"
drEditrow("BUILDING") = "WHTRF"
Case "#Person"
drEditrow("PERSON") = strMyName
Case "#PCImage"
drEditrow("PCIMAGE") = "Dell"
Case "#Serial"
drEditrow("SERIAL") = "R244Q8"
End Select
Next objItem
drEditrow.EndEdit()
AdaptSql.Update(DatComps, "Computers")
the same error message:
"Update requires a valid UpdateCommand when passed DataRow collection
with modified rows."
Here is the simplest iteration of the code that generates the error.
I've tried the commandbuilder, and that doesn't work either.
Essentially, I'm grabing a table with only one record in it and
changing some of the values. Thats it. Why doesn't it work?!?!?!?!
Thanks
Dim AdaptSql As OleDb.OleDbDataAdapter ' adapter is use to
update the dataset and datasource
Dim DatComps As DataSet
DatComps = New DataSet
AdaptSql = New OleDb.OleDbDataAdapter("SELECT ComputerName,
PERSON, EPAID, ROOM, BUILDING, PCIMAGE, SERIAL FROM(Inventory) WHERE
ComputerName='" & strComputer & "' AND EPAIS Is NULL", conADT)
AdaptSql.Fill(DatComps, "Computers")
Dim drEditrow As DataRow
drEditrow = DatComps.Tables("Computers").Rows(0)
drEditrow.BeginEdit()
For Each objItem In objEnvironment
Select Case objItem.NAme.ToString
Case "#ID"
drEditrow("EPAID") = "R4T678"
Case "#Room"
drEditrow("ROOM") = "A123"
Case "#Building"
drEditrow("BUILDING") = "WHTRF"
Case "#Person"
drEditrow("PERSON") = strMyName
Case "#PCImage"
drEditrow("PCIMAGE") = "Dell"
Case "#Serial"
drEditrow("SERIAL") = "R244Q8"
End Select
Next objItem
drEditrow.EndEdit()
AdaptSql.Update(DatComps, "Computers")