|
Posted by Erland Sommarskog on 10/02/47 11:48
Wael (sedky@rocketmail.com) writes:
> 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"
>...
> 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.
What it says. You have defined a parameter, set the name of it twice.
But you have never added it to the Parameters collection. To that end
you need to use the .Add method.
Apparently, you are very new to ADO .Net programming. Unfortunately,
newsgroups are not good venues for learning things from scratch, because
the answer will be small tidbits here and there. You are better off
trying to find some book with exercises and samples to get you going.
Or find some classes you can take in your area.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|