Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VBScript Question
Message
From
02/06/1999 10:10:57
Raymond Humphrys
Michigan Department of Community Health
Bath, Michigan, United States
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00225044
Message ID:
00225337
Views:
11
Using SQL 6.5 and developing an ADO recordset on the Server Side and passing it through IIS this is the server side script that populates an array "LocalArray".
This array does not seem to accessible on the client side VBScript. How do we make this array accessible from client-side vbscript procedures such as Combo1_OnChange().

My problem is i need to populate a combo box based upon a users selection from a different combo box. The values for the second combo box must come from an ado recordset. I thought the way to do this is to create an array on the client side that can be used from a vbscript procedure. My code for creating the array is below.

<%
rsHosp.MoveFirst
Dim LocalArray(2, 14)
For i = 0 to 14
LocalArray(0, i) = rsHosp.fields("occco")
LocalArray(1, i) = rsHosp.fields("hosp")
LocalArray(2, i) = rsHosp.fields("HospitalName")
rsHosp.MoveNext
Next
'Response.Write LocalArray(2, 5)
'Session("ServerArray") = LocalArray
%>

Then, my code for the combo1_OnChange() event is:

sub Combo1_OnChange()
dim tmp, hos
for i = 0 to 15
set oOption = document.createElement("OPTION")
tmp = LocalArray(1, i)
hos = LocalArray(2, i)
oOption.text = hos
oOption.value = tmp
form.Combo2.add(oOption)
next
end sub



>Why not just use the ADO Recordset to populate the client side combo box?
>
>>I did not want to take advantage of anyone's largesse by posting a question only tangentially related to VFP. However, if you insist. I need to know how to build a client side array from a SQL server recordset using VBScript. Example, on SQL Server I have a table with 3 columns, a, b, and C. I want to use ADO to build a recordset and pass these data down to a client side array to populate a drop-down combo box. I can hard code the values of a, b, and c into the VBScript, but the rows in the Server side table will constantly change so that is not a good idea.
>>
>>If this too far afield for this forum just nuke it ...
>>
>>thanks
>>>Why don't you post your VBScript question??? You will probably get your question answered.....correctly..< bg >
>>>
>>>
>>>>Does anyone know of a good VBScript forum like the UT and VFP. I've got a VBScript question.
>>>>
>>>>thanks
Some days it's not worth chewing through the leather straps ...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform