add one input parameter to stored procedure

D

DC Gringo

I am using the VS.NET designer to access a stored procedure with 3 SELECT
statements. It should only return 2 depending on the input parameter @p1.
When I configure a SqlDataAdapter, I only get only parameter...a
return_value. It ignores the @p1

'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "[fn3ExecBriefHome]"
Me.SqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@RETURN_VALUE",
System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue,
False, CType(0, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
'


----------------------------------------------
-- HERE IS MY STORED PROCEDURE--
----------------------------------------------

CREATE PROCEDURE

AS

@p1 varchar(5) = 'short'

as

SELECT col1
FROM table 1


If @p1= 'all'

BEGIN

-- Statement 2
SELECT col1
FROM table 1

END

Else

BEGIN

-- Statement 3
SELECT col1
FROM table1

END
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top