Jump to content

ASP.NET Stored Procedures


kwilliams

Recommended Posts

I'm pretty much a newbie when it comes to stored procedures and ASP.NET, but I'm wanting to convert all of my recordsets to stored procedures throughout my site. I'm running into trouble with what should be a simple stored procedure.This is what I classically would have done using a recordset:

<%Response.Buffer = True'Declare form variablesDim strUsername As Object = trim(Request.Form("txtUsername"))Dim strPassword As Object = trim(Request.Form("txtPassword"))'RecordsetDim objConn As Object, rsAccounts As ObjectobjConn = Server.CreateObject("ADODB.Connection")objConn.Open (strConnAccounts)rsAccounts = "SELECT * FROM tblAccounts WHERE Username = '" & strUsername & "' AND Password = '" & strPassword & "'"rsAccounts = objConn.Execute(rsAccounts)objConn.ClosersAccounts = nothingobjConn = nothing'Test outputResponse.Write("FName: " & rsAccounts("FName") & "<br />")Response.Write("LName: " & rsAccounts("LName") & "<br />")%>

How can I accomplish this with using a Stored Procedure? I don't understand how I can use variables within an ASP.NET page within a Stored Procedure's WHERE clause. Thanks for any help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...