Arg81
Well-known member
In my current queries I am running I have two parameters - @CustomerID and Status=2
The form runs fine and as long as a customer has any rows with Status of 2 then they show, but when selecting a customer from the list that doesn't have any rows with status of 2, I get error;
An unhandled exception of type 'System.FormatException' occurred in system.data.dll
Additional information: Input string was not in a correct format.
I'm assuming this is because it can't find any rows for that Customer ID.
On my query for finding RowID, I have error handling that if no RowID is entered, the user is given a "Enter ID" message, and then if the user enters an ID that doesn't exist, that also gives an error message, using
If Ds1.Table1.rows.count = 0 Then
...
...
Is there a way of putting this into my other query? I think it's falling over as there are two parameters, but I don't know where to put the error handling code.
My code for the search (using parameter @CustomerID, status=2 is hard built into dataAdapter) - user clicks a button, clears the dataTables and then repopulates them with the new rows.
The form runs fine and as long as a customer has any rows with Status of 2 then they show, but when selecting a customer from the list that doesn't have any rows with status of 2, I get error;
An unhandled exception of type 'System.FormatException' occurred in system.data.dll
Additional information: Input string was not in a correct format.
I'm assuming this is because it can't find any rows for that Customer ID.
On my query for finding RowID, I have error handling that if no RowID is entered, the user is given a "Enter ID" message, and then if the user enters an ID that doesn't exist, that also gives an error message, using
If Ds1.Table1.rows.count = 0 Then
...
...
Is there a way of putting this into my other query? I think it's falling over as there are two parameters, but I don't know where to put the error handling code.
My code for the search (using parameter @CustomerID, status=2 is hard built into dataAdapter) - user clicks a button, clears the dataTables and then repopulates them with the new rows.
VB.NET:
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
Ds1.table3.Clear()
Ds1.table2.Clear()
Ds1.table1.Clear()
ds2.table2.Clear()
da1.SelectCommand.Parameters("@CustomerID").Value = txtCustomerID.Text
da1.Fill(Ds1)
FillChild()
End Sub
Private Sub cboCustomer_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboCustomer.SelectedIndexChanged
txtCustomerID.Text = cboCustomer.SelectedValue
End Sub
Private Sub FillChild()
da2.SelectCommand.Parameters("@RowID").Value = lblID.Text
da2.Fill(Ds1)
da3.SelectCommand.Parameters("@RowID").Value = lblID.Text
da3.Fill(Ds1)
End Sub