usage of stored procedures????

Results 1 to 4 of 4

Thread: usage of stored procedures????

  1. #1
    Tripp Guest

    Default usage of stored procedures????

    Hi,<BR>How can we use stored procedures in an ASP??<BR>Can anyone help me with the creation of stored procedures, and how to call it in asp. also, where do we store the stored procedure?as a file??<BR><BR>also, how does usage of stored procedure help?for what kind of things can stored procedure be used??<BR>Thanks a lot,

  2. #2
    Ian Stallings Guest

    Default RE: usage of stored procedures????

    *<BR>Stored Procedures help by seperating the SQL statements<BR>from the ASP code. Better control. Also, SP&#039s are<BR>compiled before run time (actually its compiled the first time<BR>its ran, but that&#039s a little off topic) so they will execute<BR>quicker than a SQL statement in an ASP page.<BR><BR>Inorder to explain how to create a SP we would need to know<BR>what type of DB it is (SQL server, Oracle, etc). SP&#039s are<BR>stored in the DB itself.<BR><BR>Here is an example of calling a StoredProcedure from ASP:<BR>&#039-------------------------------------------------<BR>Set Cmd = Server.CreateObject ("ADODB.Command")<BR>Set Cmd.ActiveConnection = oConn<BR>Cmd.CommandText = "sp_qUserInfo"<BR>Cmd.CommandType = adCmdStoredProc<BR><BR>Cmd.Parameters.AppEnd Cmd.CreateParameter("LoginID", adInteger, adParamInput, 4, LoginID)<BR>Cmd.Parameters.AppEnd Cmd.CreateParameter("UserName", adVarChar, adParamInput, 64, u_UserName)<BR>Set rsUserInfo = Cmd.Execute<BR>&#039---------------------------------------------------------<BR><BR>SP&#039s call for certain Parameters that must be supplied.<BR>Its usually in this format:<BR>Cmd.Parameters.Append Cmd.Parameter("ParameterName", fieldtype,<BR>input/output?, maxlength, variable)<BR><BR>You can then write the returned data (if any) to the screen like<BR>so:<BR>&#039----------------------------------<BR>&#060;%=rsUserInfo("Firstname")%&#062;<BR>&#03 9--------------------------------<BR><BR><BR><BR>For more info on how to call a SP from ASP look here:<BR>http://msdn.microsoft.com/library/techart/msdn_visql.htm<BR><BR>Using SP&#039s is pretty common when building a 3-tier web app.<BR>Usually its ASP on the front end calling a Business Object<BR>that calls the SP&#039s in the DB, so learning these will<BR>definetly be to your advantage.<BR><BR><BR>I hope this helps :)

  3. #3
    Tripp Guest

    Default RE: That Helped

    Thanks,

  4. #4
    Join Date
    Dec 1969
    Posts
    699

    Default 3 tier web app

    Hi,<BR>you mentioned something about a 3 tier web app. Could you explain shortly what that means? Also, what is a Business Object?<BR>May be you can pass a useful URL to that theme.<BR>Thanks a lot, this is really driven me crazy, because everybody uses that expressions and I always dont know exactly what that means!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •