473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

vbscript recordset to javascript array

I have a form with a couple of dropdown fields. the dropdown fields
get the value from one table which is a reference table. The table
consists of 3 columns - type, id, name. An example would look like
this:

type id name
fruits AP apple
fruits GRA grapes
chocolate SNI snickers
chocolate MM m&m's

Currently, I have multiple sql statements to query the db for each
dropdown (Select * from tablename where type='fruits') using vbscript
(ms sql server database). My first question is, can i just use one
sql statement to grab everthing in the table and group them together,
how? the next question is, how do I convert a vbscript recordset to a
javascript array? I need to have the values on the client side so i
can do a dependent dropdown (i.e. if apple is selected in one
dropdown, MM needs to get selected).
Jul 20 '05 #1
2 2287
If you could sit down and write the required javascript then you
should be able to do it from vbscript in ASP. Just loop through the
fields and write out the js to form the array. If you're going to use
client-side js to build the selects then you don't need to split the
recordsets up - just use one and make sure you have the type as a
field in the array.

Tim.

"Dana" <dj*****@yahoo.com> wrote in message
news:2b*************************@posting.google.co m...
I have a form with a couple of dropdown fields. the dropdown fields
get the value from one table which is a reference table. The table
consists of 3 columns - type, id, name. An example would look like
this:

type id name
fruits AP apple
fruits GRA grapes
chocolate SNI snickers
chocolate MM m&m's

Currently, I have multiple sql statements to query the db for each
dropdown (Select * from tablename where type='fruits') using vbscript (ms sql server database). My first question is, can i just use one
sql statement to grab everthing in the table and group them together, how? the next question is, how do I convert a vbscript recordset to a javascript array? I need to have the values on the client side so i
can do a dependent dropdown (i.e. if apple is selected in one
dropdown, MM needs to get selected).

Jul 20 '05 #2
Dana,

You can use the getrows method which will retrieve all the rows into a vb
array and then assign the vbarray values to the js array by using ubound for
each dimension of the array and assign the values to the js array using
response.write statements.
Much quicker than reading each row of data and then manipulating it.

In terms of your current solution, you should use 'select <fieldname> from
....' rather than 'select * from ...' as that's also quicker.

Martin

"Dana" <dj*****@yahoo.com> wrote in message
news:2b*************************@posting.google.co m...
I have a form with a couple of dropdown fields. the dropdown fields
get the value from one table which is a reference table. The table
consists of 3 columns - type, id, name. An example would look like
this:

type id name
fruits AP apple
fruits GRA grapes
chocolate SNI snickers
chocolate MM m&m's

Currently, I have multiple sql statements to query the db for each
dropdown (Select * from tablename where type='fruits') using vbscript
(ms sql server database). My first question is, can i just use one
sql statement to grab everthing in the table and group them together,
how? the next question is, how do I convert a vbscript recordset to a
javascript array? I need to have the values on the client side so i
can do a dependent dropdown (i.e. if apple is selected in one
dropdown, MM needs to get selected).

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Benson | last post by:
Yes, but I was referring to VBScript apart from the runtime children like Dictionary, Network etc., like the C language apart from the Standard Library. I agree, though, Dictionaries are cool,...
2
by: Mark Sargent | last post by:
Hi All, I want to pull data from a number of tables, Categories, SubCategroies and then place into JavaScript drop downs and have the options in the second drop down change upon the selection...
3
by: Dana | last post by:
I have a form with a couple of dropdown fields. the dropdown fields get the value from one table which is a reference table. The table consists of 3 columns - type, id, name. An example would...
5
by: Doug | last post by:
I would appreciate a response on this. I have clients who will be placing text files information about in a network directory for example: http://www.protegen.com/clients/ Is it possible to...
1
by: tnhoe | last post by:
Hi,plz help me to translate following VBscript to Javascript :- Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" ) objGsmOut.Device = "MultiTech GSM MultiModem" ...
1
by: Susan | last post by:
Is it possible to use PHP with VBScript or JavaScript to upload multiple files. I'd like to automate the upload of a complete directory (not using FTP). I don't need a common form with several...
6
by: =?Utf-8?B?Sm9obiBCdW5keQ==?= | last post by:
Hey guys, I've searched high and low for a way to populate a vb array with data from a javascript array. I can find 50 ways to do it with ASP but not one for VB. I appreciate what help you can...
1
by: anniefs | last post by:
hi help me i m so much stuck int he code and i have no time .... i used ASP VBscipt and javascript functions with MS database javascript function add records in MS DB by using ASP vbscript...
14
nicebasic
by: nicebasic | last post by:
I have a small page with ASP. In one part of the program, when the user clicks on a button, I use the following code to call a VBScript Subroutine with the name of SubmitForm: <input...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.