Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Take variable out of function and place in List(ASP)

Status
Not open for further replies.

HebieBug

Programmer
Jan 8, 2001
354
JP
Am creating a DLL file
The DLL opens a database up and checks within the database if a certain criteria is met. I would then like it so that outcome stored in a variable is passed to the ASP page and displayed in a list box. A brief look at the function
Open ADO connections
With recordset
while not recordset.eof
It then opens a second database and table based on the primary key of the first connection and checks some details
If APPLE = "1" then
Listvariable = "This is a apple"
end if
.movenext
Wend
Close connections and End Function
Every time it gets the next record I would like it to display Listvariable in a listbox.
Is there any way of doing this in the ASP code so that it retrieves Listvariable

 
You can do what you are asking about but you will need to modify your dll in certain ways. The first issue is that you are going to want asp to be able to move the recordset to the next record. I could show you the basics of doing it all within asp and then you can play around with incorporating it with your dll.


<%
Dim objConn
Dim objRS
Dim strConnection
Dim strSQL

strConnection = &quot;&quot; 'enter your connection string
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.Open strConnection

strSQL = &quot;&quot; 'enter your sql statement you want to execute
set objRS = objConn.Execute(strSQL)
%>

html stuff here

<select name=&quot;lstBox&quot; size=&quot;10&quot;>
<%Do While Not objRS.EOF%>
<option><%=objRS.Fields(&quot;YourField&quot;)%></option>
<%
objRS.Movenext
Loop
%>
</select>
<%
objRS.Close
Set objRS = Nothing
Set objConn = Nothing
%>

Remainder of html stuff

You could do all this with response.write and maybe get rid of so many server calls but it all depends on different factors. If you have any questions or anything just ask. Somebody else may have a better example to tell you.....:)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top