dotolee

Getting an error:

Parameterized Query '(@Name nvarchar(100),
@comments text,@TotalCalls nchar(10),@Total'
expects parameter @IsNull_Name,
which was not supplied.

when i now try to edit a record in my databound grid. I created these controls by creating a datasource and then dragging it on to my form.

The save button on the binding navigator was working... but no longer. I can't figure out why.

This is the code behind the save button:

Private Sub TerritoryBindingNavigatorSaveItem_Click_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TerritoryBindingNavigatorSaveItem.Click

Me.Validate()

Me.TerritoryBindingSource.EndEdit()

Me.TerritoryTableAdapter.Update(Me._territor_eDataSet.Territory)

End Sub

And here's the SQL statements on the TerritoryTableAdapter:

SELECT TerritoryID, Name, comments, TotalCalls, TotalDNC, CityID
FROM Territory

UPDATE Territory
SET Name = @Name, comments = @comments, TotalCalls = @TotalCalls, TotalDNC = @TotalDNC, CityID = @CityID
WHERE (TerritoryID = @Original_TerritoryID) AND (@IsNull_Name = 1 AND Name IS NULL OR
Name = @Original_Name) AND (@IsNull_TotalCalls = 1 AND TotalCalls IS NULL OR
TotalCalls = @Original_TotalCalls) AND (@IsNull_TotalDNC = 1 AND TotalDNC IS NULL OR
TotalDNC = @Original_TotalDNC) AND (@IsNull_CityID = 1 AND CityID IS NULL OR
CityID = @Original_CityID)

While we're on the topic of the update statement, can you explain the syntax a little I don't understand why it's included all these paramaters called IsNull_fieldname...

Please and thanks.



Re: Windows Forms Data Controls and Databinding i broke something and i don't know what!

Kristian PD

I'm not a VB developer but it looks like you're missing a parameter argument for your SQL statement.

The second AND clause states (@IsNull_Name = 1), it appears as though the IsNull_Name parameter (denoted with @) is not there.

My guess is that this is in your TableAdapter code of the DataSet.
1) Go to your DataSet designer
2) Click on the TableAdapter
3) Expand the UpdateCommand
4) Click on Parameters
5) Add the parameter, specify the Source Column as the column it relates to in your table

Try it again.




Re: Windows Forms Data Controls and Databinding i broke something and i don't know what!

dotolee

tried that but now im getting an error that says:

concurrent violation: The update Command affected 0 of the expected 1 records.

not sure how to fix this.

Any comments or suggestions

Please and thanks.





Re: Windows Forms Data Controls and Databinding i broke something and i don't know what!

Kristian PD

This could be related to the "original" columns not being there try changing the "original" columns to just the @ symbol and column name without the word original.