passing arrays from VB6 to ASP pages 
Author Message
 passing arrays from VB6 to ASP pages

Hello,

I have an idea to do it. You could create an Access Database with one table
called for example MYARRAY. Lets suppose that your array has 10 rows and 10
columns. So, your VB6 could use the ADO to update the database everytime you
want to send the data to the homepage. Meanwhile, your ASP page would be
linked to the Access Database to get the data.

I will give an example to update the database from the VB6.application.
(Suppose that your Access Database is in c:\mydocuments. Do not forget to
give a reference to the Microsoft ActiveX Data Objects 2.7 library) .
Suppose the name of the fields in your database is FIELD1,
FIELD2,....,FIELD10.

Therefore the general flow of information is the following:      VB6 ----->
ACCESS DATABASE    <--------- ASP PAGE.    (It is what I could help you.
Maybe we have another solutions, but the one that I could see now it is the
following one:)

sub UpdateMyArray()

dim oconn as New ADODB.Command
dim myPath as string
myPath = "c:\mydocuments"
Strconnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + myPath + ";
Persist Security Info=False"
oconn.activeconnection = strconnect

' First of all, lets delete the old array.
oconn.commandtext = "DELETE FROM MYARRAY"
oconn.commandtype = adcmdtext
oconn.execute

dim myArray(1 to 10, 1 to 10) as string

'Let's insert the array in AccessDatabase. I suppose here you have already
your array ready.

dim i as integer, j as integer
dim Sentence as string
dim Values1 as string
Sentence="("
Values1="('"    ' I used Values1 because VALUES is a reserved word of SQL.

for i = 1 to 10            ' Rows of the array

for j = 1 to 10           ' Columns of the array

    if j < 10 then
    Sentence = sentence + "FIELD" + Cstr(i) + ","
    Values1 = values1 + myArray(i,j) + "','"
    else
    Sentence = sentence + "FIELD" + Cstr(i) + "')"
    Values1 = values1 + myArray(i,j) + "')"
    end if

next

'At this point we can update the Array.
oconn.commandtext = "INSERT INTO MYARRAY" + Sentence + " VALUES" + Values1
oconn.commandtype = adcmdtext
oconn.execute

next

set oconn = nothing
End sub
------------------------------------------------------------------------

Now, if you want to see this array in your webpage you can put this code in
your ASP page.

<!--METADATA TYPE="typelib" FILE="d:\program files\common
files\system\ado\msado15.dll"-->

<%
dim oconn
set oconn = server.createobject("ADODB.Command")
dim myPath
myPath = "c:\mydocuments"
Strconnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + myPath + ";
Persist Security Info=False"

oconn.activeconnection = strconnect

' I do not know what you want to do with your array, but if you want to show
it in the webpage you can do the following.

oconn.commandtext = "SELECT * FROM MYARRAY"
oconn.commandtype = adcmdtext

dim objrs
dim temporary

set objrs = oconn.execute

while not objrs.eof

    for i = 1 to 10

    temporary = "FIELD" + Cstr(i)

    response.write objrs(temporary)

    next

    response.write "<p>"
objrs.movenext
wend

set objrs = nothing
set oconn = nothing

%>

I do not know exactly what you want to do or what your application has to
do...Anyway, if it is not exactly it, let me know more details about what
you really want to do ok !!!!

Regards,

Leandro Lacorte Recova
RF Engineer
Metro RF Services, Inc. Walnut-CA


Quote:
> Hi Guys

>    I am trying to pass a array of string from a vb6 app
> from a client to an asp page. I know how to send a single
> string but not array, if anybody have any idea on how I
> should tackle this problem i would be greatful

> Thanks :)



Tue, 17 Aug 2004 02:35:12 GMT  
 passing arrays from VB6 to ASP pages
Hello,

I have an idea to do it. You could create an Access Database with one table
called for example MYARRAY. Lets suppose that your array has 10 rows and 10
columns. So, your VB6 could use the ADO to update the database everytime you
want to send the data to the homepage. Meanwhile, your ASP page would be
linked to the Access Database to get the data.

I will give an example to update the database from the VB6.application.
(Suppose that your Access Database is in c:\mydocuments. Do not forget to
give a reference to the Microsoft ActiveX Data Objects 2.7 library) .
Suppose the name of the fields in your database is FIELD1,
FIELD2,....,FIELD10.

Therefore the general flow of information is the following:      VB6 ----->
ACCESS DATABASE    <--------- ASP PAGE.    (It is what I could help you.
Maybe we have another solutions, but the one that I could see now it is the
following one:)

sub UpdateMyArray()

dim oconn as New ADODB.Command
dim myPath as string
myPath = "c:\mydocuments"
Strconnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + myPath + ";
Persist Security Info=False"
oconn.activeconnection = strconnect

' First of all, lets delete the old array.
oconn.commandtext = "DELETE FROM MYARRAY"
oconn.commandtype = adcmdtext
oconn.execute

dim myArray(1 to 10, 1 to 10) as string

'Let's insert the array in AccessDatabase. I suppose here you have already
your array ready.

dim i as integer, j as integer
dim Sentence as string
dim Values1 as string
Sentence="("
Values1="('"    ' I used Values1 because VALUES is a reserved word of SQL.

for i = 1 to 10            ' Rows of the array

for j = 1 to 10           ' Columns of the array

    if j < 10 then
    Sentence = sentence + "FIELD" + Cstr(i) + ","
    Values1 = values1 + myArray(i,j) + "','"
    else
    Sentence = sentence + "FIELD" + Cstr(i) + "')"
    Values1 = values1 + myArray(i,j) + "')"
    end if

next

'At this point we can update the Array.
oconn.commandtext = "INSERT INTO MYARRAY" + Sentence + " VALUES" + Values1
oconn.commandtype = adcmdtext
oconn.execute

next

set oconn = nothing
End sub
------------------------------------------------------------------------

Now, if you want to see this array in your webpage you can put this code in
your ASP page.

<!--METADATA TYPE="typelib" FILE="d:\program files\common
files\system\ado\msado15.dll"-->

<%
dim oconn
set oconn = server.createobject("ADODB.Command")
dim myPath
myPath = "c:\mydocuments"
Strconnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + myPath + ";
Persist Security Info=False"

oconn.activeconnection = strconnect

' I do not know what you want to do with your array, but if you want to show
it in the webpage you can do the following.

oconn.commandtext = "SELECT * FROM MYARRAY"
oconn.commandtype = adcmdtext

dim objrs
dim temporary

set objrs = oconn.execute

while not objrs.eof

    for i = 1 to 10

    temporary = "FIELD" + Cstr(i)

    response.write objrs(temporary)

    next

    response.write "<p>"
objrs.movenext
wend

set objrs = nothing
set oconn = nothing

%>

I do not know exactly what you want to do or what your application has to
do...Anyway, if it is not exactly it, let me know more details about what
you really want to do ok !!!!

Regards,

Leandro Lacorte Recova
RF Engineer
Metro RF Services, Inc. Walnut-CA


Quote:
> Hi Guys

>    I am trying to pass a array of string from a vb6 app
> from a client to an asp page. I know how to send a single
> string but not array, if anybody have any idea on how I
> should tackle this problem i would be greatful

> Thanks :)



Tue, 17 Aug 2004 02:38:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing an Array from a COM Object to an ASP Page

2. passing array from componet to asp: cann't display all the infor from asp

3. ObjectContext vs. Passing ASP objects from ASP page

4. calling asp page from another asp page

5. Passing Arrays from VB .Net to ASP

6. Passing a variant array from asp to a cls and back

7. Problem passing a variant array out of VBasic object to ASP

8. Passing Arrays between ASP/VBScript and ActiveX Components...

9. Passing Arrays to a Function in ASP (VBScript)

10. Pass array from ASP to VB ActiveX DLL

11. Passing MultiDimensional Array from ASP to VBScript

12. Passing array between ASP script(vbscript) and javascript

 

 
Powered by phpBB® Forum Software