Total Newbie Question (Database and ASP)

Author Message
torvalen

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 2/24/2009
  • Status: offline
Total Newbie Question (Database and ASP) Tuesday, February 24, 2009 11:20 PM (permalink)
0
Hi
I have started learning ASP, but there's somthing basic that I don't understand.
I would like to refer to database records in a subroutine, but I don't know how.
I have made a little example. When I click the button, I call the subroutine(MYSUB) where I would like to run through the records. However, I can't refer to the recordset inside the subroutine. Somehow I have to transfer the recordset to the subroutine, but I don't know how. Please tell me.
Sorry for my bad english. I live in Denmark.
 
EXAMPLE:
 
 
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim rsRes
Dim rsRes_cmd
Dim rsRes_numRows
 
Set rsRes_cmd = Server.CreateObject ("ADODB.Command")
rsRes_cmd.ActiveConnection = “CONNECTION STRING”
rsRes_cmd.CommandText = "SELECT * FROM tblResources"
rsRes_cmd.Prepared = true
 
Set rsRes = rsRes_cmd.Execute
rsRes_numRows = 0
%>
<head>
 
<script language = "VBScript">
sub MYSUB
While (NOT rsRes.EOF)           ???????????
 
“HERE I WANT TO LOOK AT THE RECORDSETS WHEN I CLICK THE BUTTON”
 
rsRes.MoveNext()
Wend
end sub
</script>
 
</head>
 
<body>
<form id="form1" name="form1" method="post">
  <input type="submit" name="Button" id="Button" value="MYSUB" />
</form>
</body>
 
BR. Tor Valen, Denmark
 
#1
    webber123456

    • Total Posts : 58
    • Scores: 0
    • Reward points : 0
    • Joined: 9/20/2007
    • Status: offline
    RE: Total Newbie Question (Database and ASP) Thursday, February 26, 2009 5:13 AM (permalink)
    0
    are you trying to pass a server side recordset into clientside coding ?

    <message edited by webber123456 on Thursday, February 26, 2009 5:18 AM>
     
    #2
      wvdba

      • Total Posts : 1
      • Scores: 0
      • Reward points : 0
      • Joined: 5/4/2009
      • Status: offline
      RE: Total Newbie Question (Database and ASP) Monday, May 04, 2009 3:13 AM (permalink)
      0
      what you're trying to do is totally service side stuff. but, you're coding client side code. database recordsets are handled on the server side. like this:

      <form name="frm1" action="yourpage.asp" method="post">

      access your data, enumerate through database records

      <input type="hidden" name="submit" value="Submit"><INPUT TYPE="submit" class="GO" VALUE="Submit">
      When you ASCII stupid question, you get stupid ANSI
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9