Posted by Wael on 05/23/06 01:20
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSearch.Click
Dim drParents As SqlDataReader
Dim cmdParents As New SqlCommand
Dim spParamenters As New SqlParameter
cnParents.ConnectionString = Constants.ConnectionString
cmdParents.CommandType = CommandType.StoredProcedure
cmdParents.CommandText = "sp_SEARCH_MULTIPLE_NAMES"
spParamenters.ParameterName = "@search4fatherOf"
spParamenters.ParameterName = "@returnfullname"
cmdParents.Parameters("@search4fatherOf").Value =
txtSearchParent.Text
cmdParents.Parameters("@returnfullname").Value = "test"
spParamenters.SqlDbType = SqlDbType.VarChar
cmdParents.Parameters.Add(spParamenters)
cnParents.Open()
cmdParents.Connection = cnParents
drParents = cmdParents.ExecuteReader
Response.Write(drParents.GetString(0))
drParents.Close()
End Sub
I have to give the output parameter a value otherwise it doesn't work.
Here is the error i get:
An SqlParameter with ParameterName '@search4fatherOf' is not contained
by this SqlParameterCollection.
Before I used the parameters I used to get an error that there was no
data. I don't see why I should be using 'Output' since I have to use
the SELECT statement anyway.
Navigation:
[Reply to this message]
|