Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ASP IIS Array

Posted on 2011-05-04
17
Medium Priority
?
251 Views
Last Modified: 2012-05-11
I am testing the following code and see no reason why it should not work...
Any ideas?


<%

dim rs
dim con

Set con = Server.CreateObject("ADODB.Connection")
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Main.mdb") & ";"

strQuery= "SELECT * FROM Main"
Set rs = con.Execute(strQuery)

Dim arrMain()



If Not rs.EOF
 'Gets all the records
arrMain = rs.GetRows()
End If



Dim iRowLoop, iColLoop
For iRowLoop = 0 to UBound(arrMain, 2)
  For iColLoop = 0 to UBound(arrMain, 1)
    Response.Write(arrMain(iColLoop, iRowLoop) & "<br>")
 		
		
 Next 

 
Next 




	
rs.Close
Set rs = nothing
		
 
%>

Open in new window

0
Comment
Question by:Baxters801
  • 8
  • 8
17 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 35692770
Can you attach Main.mdb, maybe problem with table structure.
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 35692826
are you getting an error or is nothing being written out to the screen? more info please!
0
 

Author Comment

by:Baxters801
ID: 35692872
Sure
MAIN.mdb
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Baxters801
ID: 35692889
I am getting a generic error...webpage cannot be displayed in IE
and An error occurred on the server when processing the URL in Firefox
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 35692900
is it a 500 error message? if so, turn off friendly error messages in IE
0
 

Author Comment

by:Baxters801
ID: 35692950
The same as Firefox
An error occurred on the server when processing the URL
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 35692985
ok lets try some debugging :)

<%
on error resume next

dim rs
dim con

Set con = Server.CreateObject("ADODB.Connection")
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Main.mdb") & ";"
if err.Number <> 0 then Response.Write "error connecting to db"

strQuery= "SELECT * FROM Main"
Set rs = con.Execute(strQuery)
if err.Number <> 0 then Response.Write "error executing query"

Dim arrMain()



If Not rs.EOF
 'Gets all the records
arrMain = rs.GetRows()
if err.Number <> 0 then Response.Write "error using GetRows()"
End If



Dim iRowLoop, iColLoop
For iRowLoop = 0 to UBound(arrMain, 2)
  For iColLoop = 0 to UBound(arrMain, 1)
    Response.Write(arrMain(iColLoop, iRowLoop) & "<br>")
    if err.Number <> 0 then Response.Write "error writing out array<br>"
             
            
 Next

 
Next
      
rs.Close
Set rs = nothing
            
 
%>

can you let me know what happens when you run this code?
0
 

Author Comment

by:Baxters801
ID: 35693052
Same error...:(
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 35693118
ok looks like you have IIS to NOT send error messages to the client (I assume you're using IIS 7?) try this:

1) Start an elevated command prompt. Right-click the command shell item in the Start-Accessories menu and select "Run as Administrator".

2) Run the following command: %windir%\system32\inetsrv\appcmd set config -section:asp -scriptErrorSentToBrowser:true

0
 

Author Comment

by:Baxters801
ID: 35693172
error using GetRows()error writing out array
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 35693184
ok can you comment out on error resume next and report back?
0
 

Author Comment

by:Baxters801
ID: 35693239
Microsoft VBScript runtime error '800a000d'

Type mismatch

/asthma/rszone11.asp, line 21
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 35693263
can you post line 21 in your newly updated code?
0
 

Author Comment

by:Baxters801
ID: 35693290
arrMain = rs.GetRows()
0
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 35693393
dont declare arrMain as an array, just do:

Dim arrMain
0
 

Author Closing Comment

by:Baxters801
ID: 35693533
That did it...Now hopefully i can this translated to my production application....
Thank you so much...
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 35693576
glad I could help :)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question