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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Error

Status
Not open for further replies.

Mandrutza

Programmer
Feb 12, 2002
34
RO
When i try to run an asp file I receive: "Subscript out of range". Does anyone knows what that means ? I hope that tomorow I'll still be alive and kicking.
 
sounds like you are referencing an area of an array that doesnt exist - can we see the code in question?? Tony
reddot.gif WIDTH=400 HEIGHT=2 VSPACE=3

 
Here is the code:

strSQL="SELECT [data],[houra] FROM [" & fisier & "] WHERE [cip]='" & ip(0,i)&"'"
objRS.Open strSQL,objConn
lung=objRS.RecordCount
datele=objRS.GetRows(lung,0)
objRS.Close
for j=1 to lung
ERROR ----> odata=Minute(datele(j,1))-20
if datele(j-1,0)=datele(j,0) and Minute(datele(j-1,1))<odata then ..... I hope that tomorow I'll still be alive and kicking.
 
because you are calling objRS.RecordCount, you need to set the cursor type of your recordset to adOpenStatic like this:
Code:
objRS.Open strSQL,objConn,adOpenStatic
lung=objRS.RecordCount

If you dont do this then your value of objRS.RecordCount will be equal to -1 - which will be an illegal dimension of your array

Your code will also require the following include file for the adOpenStatic VBScript constant (if you havent already got it included - dont forget to check the path is right for your server)
Code:
<!-- METADATA TYPE=&quot;typelib&quot; FILE=&quot;C:\Program Files\Common Files\System\ado\msado15.dll&quot; -->
Tony
reddot.gif WIDTH=400 HEIGHT=2 VSPACE=3

 
In my asp file I used RecordCount before without using adOpenStatic and worked fine. I think there is a problem with GetRows.I'm not quite sure that I understood very well this method. I do not know what type of array returns and the order in that array . I hope that tomorow I'll still be alive and kicking.
 
the actual record count,a number. I hope that tomorow I'll still be alive and kicking.
 
Help please ! I hope that tomorow I'll still be alive and kicking.
 
that is not the solution.also did not worked. I hope that tomorow I'll still be alive and kicking.
 
Should your call to objRS.GetRows use 0 or 1 as the starting value?
 
I used 0 as the starting value: objRS.GetRows(lung,0)
I hope that tomorow I'll still be alive and kicking.
 
Have you tried to only enumerate the datele array with a normal
for i=LBound(datele,1) to UBound(datele,1)
for j=LBound(datele,2) to UBound(datele,2)
Response.write(i & &quot;, &quot; & j & &quot;=&quot; & datele(i,j))
Next
Next

This will allow you to know the exact content and bounds of the array. By the way, you could try to not write parameters in the getRows function since your parameters are normally the same as the default which would remove the recordCount line.
 
My use of the GetRows must be different than yours:

Code:
Set objDC = Server.CreateObject(&quot;ADODB.Connection&quot;)
objDC.ConnectionTimeout = 15
objDC.CommandTimeout = 30

'Code to connect to Oracle Warehouse
 objDC.Open &quot;Provider=MSDAORA.1;Password=pswrd;User ID=myod;Data Source=mydata;Persist Security Info=TRUE&quot;

SqlStrEmp = &quot;Select distinct empl_nm,empl_nbr empnbr from warehouse.hr_public where rownum < 25 order by empl_nm&quot;
Set RS1 = objDC.Execute(SqlStrEmp)
arrEmpData = RS1.GetRows()
' set First Record ( 1st entry in arrEmpData )
iRecFirst   = LBound(arrEmpData, 2)
iRecLast    = UBound(arrEmpData, 2)
iFieldFirst = LBound(arrEmpData, 1)
iFieldLast  = UBound(arrEmpData, 1)
' so try this
for I = iRecFirst to iRecLast
etc....

hth,
[profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top