Please help! Visual Studio VB.NET 2005 - DB: Teradata - .NET Data Provider for Teradata. (teradat.client.profile.dll) I have given my dataAdapter this Select command.
SELECT * FROM DEV_DATA_T.MISRE_Threshold ORDER BY ID1
It has returned this for my Update Statement.
UPDATE "DEV_DATA_T"."MISRE_Threshold" SET "ThresholdType" = ?, "ThresholdValue" = ?, "Threshold_Flag" = ?, "Actual" = ?, "Fail" = ?, "Category" = ?, "ID1" = ? WHERE (("ThresholdType" = ?) AND ("ThresholdValue" = ?) AND ((? = 1 AND "Threshold_Flag" IS NULL) OR ("Threshold_Flag" = ?)) AND ("Actual" = ?) AND ("Fail" = ?) AND ((? = 1 AND "Category" IS NULL) OR ("Category" = ?)) AND ((? = 1 AND "ID1" IS NULL) OR ("ID1" = ?))) -- 17 placeholder params.
I get Error 3939: There is a mismatch between the number of parameters specified and the number of parameters required.
The update, insert, delete, select & table mappings were created. My table has a primary key.
The update statement has 17 parameters & the parameters collection for the update command has 17 parameters too. One for each placeholder above and 3 extra for lines 5,7 & 8 where placeholders are used as the columnName = 1...
How can this be happening? It's almost as if the dataset software ignores the fact that the placeholders should be substituted for values as it gets the same error that you would get if you simply copied the update into queryman!
Private Sub btnUpdateDataSet2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdateDataSet2.Click
If DataSet11.HasChanges Then CursorOn() Try TdCommandBuilder = New Teradata.Client.Provider.TdCommandBuilder(TdDataAdapter1) TdDataAdapter1.Update(DataSet11.MISRE_Threshold) Catch ex As Exception MessageBox.Show(ex.ToString) MessageBox.Show("Update failed. Possible cause:Constraints.") End Try
CursorOff() sbThresholds.Text = "Threshold data updated." Else MessageBox.Show("No changes were made to the Dataset.") End If