Yet Another TableAdapter.Update that doesn't work

icecrew

New member
Joined
Aug 24, 2008
Messages
2
Programming Experience
10+
Hi List,

I created a typed dataset by dragging the table from Server Explorer onto my dataset designer. The TableAdapter.Fill and FillByXXX methods (that I created) work perfectly, but the Update method always returns 0. I placed the following code just before the Update method call just to make sure the adapter realizes that some rows have been added:

VB.NET:
Dim row As dsTest.TestTableRow
For Each row In dsTest.TestTable
     MsgBox("RowState = " & row.RowState.ToString)
Next
Msgbox("Rows affected = " & adpTestAdapter.Update(dsTest.TestTable))

When I execute the above code I get the prompt "RowState = Added", followed by the prompt "Rows affected = 0". The adapter doesn't update anything!:confused:

I even went as far as deliberately modifying the INSERT, UPDATE and DELETE commands so as to produce a syntax error. E.g. InsertCommand.CommandText = "I_N_SERT INTO...". The Update() method didn't even throw an exception.

I'm using VS2005 and I'm connecting to an SQL Server 2005 database (Pro Edition). Any ideas? I'm stumped :confused:
 

icecrew

New member
Joined
Aug 24, 2008
Messages
2
Programming Experience
10+
I removed the dataset from my VS project and re-created a new typed dataset. Voila, it somehow works! :eek: I'm looking at the old & new xsd and code files and so far everything looks identical. :confused:

Thanks for the offer cjard, if the mystery behavior pops up again, I'll post the proj.

Thanks again
 
Top Bottom