Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Passing a value from an asp/vbscript page to a new window


Message #1 by dirosky@h... on Thu, 22 Nov 2001 10:31:42
What you need to put in while loop:

while (!adoRecordset.eof)
{
<%
 Name: <%=adoRecordset("KnownAs").Value%> <%=adoRecordset("Surname").Value%
 <BR><BR>
 Home Phone Number: <%=adoRecordset("HomePhone").Value%>
<br>
%>
adoRecordset.move(1);
}

This should solve you problem.


> Hi, A newbie to Javascript
> 
> I have an asp page that returns a record from an access database using 
> vbscript. I have added a hyperlink that will hold staffID from the url, 
> open a new window and then query the access database from the new window 
> to return certain values. At the moment I have got as far as opening the 
> window but it returns only the first record's values. Code below:
> 
> Asp page code:
> 
> <A NAME="ContactLink" HREF="" onclick="return showDetails
('ContactDet.asp?
> StaffID=<%Request.QueryString("StaffID")%>')">Contact This member of 
> staff</A></TD>
> 
> New Window Code:
> 
> <%
> var varStaffID = Request.QueryString("StaffID")
> 
> //Open connection to database, then populate a recordset with list of 
staff
> 
> var adoConnection = Server.CreateObject("ADODB.Connection");
> var adoRecordset;
> var MySQL;
> adoConnection.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source= 
> C:\\Datastores\\reliefstaff.mdb; Persist Security Info=False");
> var MySQL = "SELECT KnownAs, Surname, HomePhone, MobilePhone FROM 
> StaffDetails1 WHERE StaffID = varStaffID";
> adoRecordset = adoConnection.Execute(MySQL);
> %>
> 
> Name: <%=adoRecordset("KnownAs").Value%> <%=adoRecordset
("Surname").Value%>
> <BR><BR>
> Home Phone Number: <%=adoRecordset("HomePhone").Value%>
> 
> <%
> 
> //Close Recordset and Connections
> 
> adoRecordset.Close();
> adoRecordset = null;
> adoConnection.Close();
> adoConnection = null
> 
> %>
> 
> 
> </BODY>
> 
> </HTML>
> 
> I would be grateful for some guidance.
> 
> Patrick

  Return to Index