a novice query and hopefully one that wont take up too much of anyones time i am working on a form that returns the contents of a table depending on what user types in. the bit of code that generates the resulting table works fine and basically loops through and returns the values according to the sql query. what i would like to do instead of outputting all table values is set up dims for each value so that I might work with each value separately. For example something like the following so that I may refer to the easting or northing value of the returned row separately. I did try a few variations on the code below but am a little uncertain as to how to refer to a specific value in a returned record dim xCoord dim yCoord xCoord = rs("easting").value yCoord = rs("northing").value Code (markup): The aim is for a little more flexibility as to what I can then do with the variables for each returned record, for example I hope to include the x and y values into a function such as the following <a href="javascript:ZoomToPointOnMap(<%=xCoord%>,<%=yCoord%>); self.close();"> Click for Map </a> Code (markup): My apologies for any lack of clarity, I have included the .asp file contents below <%@ Language="VBScript" %> <% Option Explicit Dim rs, cn, oFld, sLine, sFields Dim datStartDay datStartDay = Request.Form("StartDay") Dim strPestType strPestType = Request.Form("pType") Dim SQLQuery SQLQuery = "SELECT NAME, STARTDATE, CASEFULLREF, DESCRIPTION3, SCHEDULEDATE FROM mytable WHERE STARTDATE >= '" & datStartDay & "' AND CODE3 = '" & strPestType & "' order by STARTDATE" set cn = Server.CreateObject("ADODB.Connection") cn.ConnectionString = "Provider=what;DSN=what;UID=what;PWD=what" cn.open if Request.Form("pType") = "all" then SQLQuery = "SELECT NAME, STARTDATE, CASEFULLREF, DESCRIPTION3, SCHEDULEDATE FROM mytable WHERE STARTDATE >= '" & datStartDay & "' order by STARTDATE" else SQLQuery = SQLQuery end if set rs = Server.CreateObject("ADODB.Recordset") rs.Open SQLQuery, cn <!-- Section used to return text should no values be returned in search --> if rs.EOF then dim msg msg = "<font size=""4"" face=""Arial""><strong>There are no matching records found.</strong><p> " ' SQLQuery & "." msg = msg + "Hit this button to <input type=button value='Try again' onClick='javascript:history.back();'>" Response.Write msg Response.End end if <!-- End of Section used to return text should no values be returned in search --> sLine = "" '"<Table border=""1"">" do while not rs.EOF sLine = sLine & "<TR>" sFields = "<TR>" for each oFld in rs.Fields sLine = sLine & "<TD>" & oFld.Value & "</TD>" sFields = sFields & "<TD>" & oFld.Name & "</TD>" next sFields = sFields & "</TR>" sLine = sLine & "</TR>" rs.MoveNext loop 'Response.Write "</Table>" rs.Close cn.close set rs = nothing set cn = nothing %> <Table border="1"> <%= sFields %> <%= sLine %> </Table> Code (markup): thank you mo
hi John thank you for the response. i have tried the format you suggested right before the following line sLine = "" '"<Table border=""1"">" Code (markup): but am faced with the only too familiar 'the page cannot be displayed' page any suggestions mo
hi, there's an awful lot of quotes in there, are you sure that's not the problem. It could be rewritten as sLine = "<Table border='1'>"
sLine = "" '"<Table border=""1"">" should be sLine = "<Table border=""1"">" this is improperly coded: "" '