I configured a data adapter and a dataset to connect to a SQL database. Also
I wrote a code to setup a currency manager for data binding on the form load
event.
On a button click event, I want to show the client's data based on the
client's first and last name typed in 2 text boxes (filtering data based on
those 2 text boxes). I used the following code for the event click, but got
an error message " An SqlParameter with ParameterName '@SHR_LAST_NAME' is not
contained by this SqlParameterCollection". Please Help!!
Dim irecords As Integer
Dim bloading As Boolean
If TextBox1.Text <> "" And TextBox2.Text <> "" Then
bloading = True
SqlDataAdapter_Preven.SelectCommand.Parameters("@S HR_LAST_NAME").Value =
TextBox1.Text
SqlDataAdapter_Preven.SelectCommand.Parameters("@S HR_FIRST_NAME").Value =
TextBox2.Text
PrevenClientsDataSet._Table.Clear()
irecords = SqlDataAdapter_Preven.Fill(PrevenClientsDataSet)
If irecords = 0 Then
MessageBox.Show("Child Name Not Found.", "Entry Error")
TextBox1.Focus()
Else
TextBox1.Focus()
End If
bloading = False
Else
MessageBox.Show("You must enter a valid Child Name.", "Data
Error")
TextBox1.Focus()
End If
End Sub
--
TS