Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
03-19-2006, 07:24 PM #1
- Join Date
- Mar 2006
- Thanked 0 Times in 0 Posts
Passing a value to a stored procedure
I am currently trying to pass a value from a url to a sqldatasource control. There seems to be a lack of information on how to do this. I would greatly appreciate the help.
I am passing a variable "dept" through the url (i.e. products.aspx?dept=23) and trying to insert it into the Where part of my SQL statement.
The stored procedure is defined as follows:
CREATE PROCEDURE ProductSearch (@Search int) AS EXEC('SELECT parts.name, manufacturer.name AS Expr1, parts.model, parts.price, parts.image1 FROM manufacturer INNER JOIN parts ON manufacturer.ID = parts.brand WHERE parts.category = @Search') RETURN
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString1 %>" SelectCommandType="StoredProcedure" SelectCommand="ProductSearch"> </asp:SqlDataSource>