hey guys, i'm a newbie to stored procedures and i really have no idea how to pass variables to them and how to retrieve values back from a stored procedure.i've used asp and sql server before but i've never wanted to use stored procedures until now.i was hoping if i show you guys a quick example of something i would like to try and use a stored procedure for then hopefully you can help me start my learning curve.example:i would like to get an account_Name from a user and then check a table called Users to find out the User_ID that corresponds with that account_Name. in asp i could achieve this by creating a form: <form name="frmLogin" method="get" action="userid2.asp"> <table width="22%" border="0"> <tr> <td width="8%">Username:</td> <td width="92%"> <input type="text" name="Account_Name"> </td> </tr> <tr> <td width="8%"> </td> <td width="92%"> <input type="submit" name="Submit" value="Login"> </td> </tr> </table></form>
then that sends my Account_Name variable to a userid2.asp page and on that page i qould have the following code: %@LANGUAGE="VBSCRIPT"%><!--#include file="Connections/DSNIntranet.asp" --><%Dim myvarmyvar = "1"if (Request.QueryString("Account_Name") <> "") then myvar = Request.QueryString("Account_Name")%><%set rsTest = Server.CreateObject("ADODB.Recordset")rsTest.ActiveConnection = MM_DSNIntranet_STRINGrsTest.Source = "SELECT User_ID, Account_Name FROM dbo.Users WHERE Account_Name = '" + Replace(myvar, "'", "''") + "'"rsTest.CursorType = 0rsTest.CursorLocation = 2rsTest.LockType = 3rsTest.Open()rsTest_numRows = 0%><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body bgcolor="#FFFFFF" text="#000000"><%=(rsTest.Fields.Item("User_ID").Value)%> </body></html><%rsTest.Close()%> i know thats simple enough there and i am pretty sure that i could use the following stored procedure: Create procedure Retrieve_User_ID @accountName varchar(16), @userID int = 0 output As Select @userID = [User_ID] from Users where Account_Name = @accountNameGO
but i don't know how i send or receive values.i hope one of you guys can point me in the right direction cause i'm so confused it's not funny. *gets on knees and begs* please can someone help me out. if anyone knows of a really simple tute and sends me a link to that i'd be more than happy. thanking you in advance,bronson