|
 |
asp_web_howto thread: Re: Help me with a simple problem
Message #1 by Nikos <pappas@c...> on Wed, 01 Jan 2003 02:37:41 +0200
|
|
try to change the:
RS2.Open sqlquery, Conn, 1, 3
to
RS2.Open sqlquery, Conn, 1, 1
as I thing 3 does not support recordcount
(not very sure about it but maybe this will help)
happy new year everybody!!!!
At 11:44 μμ 31/12/2002, you wrote:
>I did that and I still get the error, it says "Subscript out of range: '11'"
>because the array is already declared at 10 why is my ReDim not working?
>
>-----Original Message-----
>From: kyle.b.willman@u...
>[mailto:kyle.b.willman@u...]
>Sent: Tuesday, December 31, 2002 12:47 PM
>To: ASP Web HowTo
>Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Try:
>
>X=0
>
>See whether this will give you the same error...
>
>Kyle B. Willman
>PricewaterhouseCoopers LLP
>Office: xxx.xxx.xxxx
>Cell: xxx.xxx.xxxx
>
>
>
>
>"Lucas Haines" <LucasHaines@a...>
>12/31/2002 01:09 PM
>
>Please respond to "ASP Web HowTo"
>
>
> To: "ASP Web HowTo" <asp_web_howto@p...>
> cc:
> Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>When I do that i get Subscript out of range pointing to
>
> ContractID(X) = RS2.Fields("ID")
>
>Any other Ideas?
>
>-----Original Message-----
>From: kyle.b.willman@u...
>[mailto:kyle.b.willman@u...]
>Sent: Tuesday, December 31, 2002 10:40 AM
>To: ASP Web HowTo
>Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Did you try this?
>
>
> Set Conn = server.Createobject("ADODB.Connection")
> Set RS2 = server.CreateObject("ADODB.Recordset")
> sqlquery = "SELECT * FROM CONTRACTS"
> Conn.open ("DATABASENAME")
> RS2.Open sqlquery, Conn, 1, 3
>
> Dim ContractID(10)
> Dim X
>
> ReDim ConractID(RS2.RecordCount)
>
> X = 1
>
> DO While NOT RS2.EOF
>
> ContractID(X) = RS2.Fields("ID")
> X = X + 1
>
> RS2.MoveNext
>
> Loop
>
>Kyle B. Willman
>PricewaterhouseCoopers LLP
>Office: xxx.xxx.xxxx
>Cell: xxx.xxx.xxxx
>
>
>
>
>"Lucas Haines" <LucasHaines@a...>
>12/31/2002 12:31 PM
>
>Please respond to "ASP Web HowTo"
>
>
> To: "ASP Web HowTo" <asp_web_howto@p...>
> cc:
> Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Okay one last time This is it. Here is my code...
>
> Set Conn = server.Createobject("ADODB.Connection")
> Set RS2 = server.CreateObject("ADODB.Recordset")
> sqlquery = "SELECT * FROM CONTRACTS"
> Conn.open ("DATABASENAME")
> RS2.Open sqlquery, Conn, 1, 3
>
> **-Dim ContractID(RS2.RecordCount)
>
> DO While NOT RS2.EOF
> ContractID(RS2.RecordCount) = RS2.Fields("ID")
> ReDim ConractID(RS2.RecordCount)
> RS2.MoveNext
>
> Loop
>When i run this script i get a "Expected Integer Constant" pointing to
>"**"
>When i re-write it to "Dim ContractID(25)" ANd run the script I get a Sub
>Script Out of Range error can some one please tell me what i'm doing
>wrong.
>Thank you in adavnce.
>
>Lucas
>
>
>-----Original Message-----
>From: Mark Eckeard [mailto:meckeard2000@y...]
>Sent: Tuesday, December 31, 2002 9:48 AM
>To: ASP Web HowTo
>Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Lucas,
>
>Use:
>
>RS2.recordcount.
>
>Mark
>--- Lucas Haines <LucasHaines@a...> wrote:
> > Thank you Karan. I have one last question what
> > should i use to figure out
> > the max number or records in the recorset to declare
> > the array.
> >
> > "ContractID(RS2.Maxrecords)"?
> >
> > Thank you in advance.
> >
> > Lucas
> >
> > -----Original Message-----
> > From: Karan Bajoria [mailto:karan@t...]
> > Sent: Monday, December 30, 2002 9:14 PM
> > To: ASP Web HowTo
> > Subject: [asp_web_howto] Re: Help me with a simple
> > problem
> >
> >
> > The problem here is that you haven't declared the
> > array.You have to first
> > declare the array
> > Ex : Dim ContractID(10)
> > Then you have to redifine the array size according
> > to the no.of values you
> > want to store in the array.
> > So you may do so
> > Ex: Redim ContractID(RS2.RecordCount)
> > After doing this you will not get a error.
> > Thanks
> > Karan Bajoria
> >
> > ----- Original Message -----
> > From: Lucas Haines <LucasHaines@a...>
> > To: ASP Web HowTo <asp_web_howto@p...>
> > Sent: Tuesday, December 31, 2002 3:40 AM
> > Subject: [asp_web_howto] Help me with a simple
> > problem
> >
> >
> > > Here is my simple problem....
> > >
> > > I have declared an array and everytime i try to
> > input data with a Do Loop
> > > from an SQL database i get a type mismatch error
> > what is the porblem.
> > > **--denotes the error line.
> > >
> > > Set Conn = server.Createobject("ADODB.Connection")
> > > Set RS2 = server.CreateObject("ADODB.Recordset")
> > > sqlquery = "SELECT * FROM CONTRACTS"
> > > Conn.open ("DATABASE NAME")
> > > RS2.Open sqlquery, Conn, 1, 3
> > > count = 0
> > >
> > > DO While NOT RS2.EOF
> > > ** ContractID(count) = RS2.Fields("ID") **
> > > Response.Write (ContractID(Count))
> > > Count = Count + 1
> > > RS2.MoveNext
> > > Loop
> > >
> > > Please get back to me if you know anything or have
> > a suggestion
> > >
> > > Thanks,
> > >
> > > Lucas
> > >
> > >
> >
> >
> >
> >
>
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
>http://mailplus.yahoo.com
>
>
>
>
>
>
>
>
>_________________________________________________________________
>The information transmitted is intended only for the person or entity to
>which it is addressed and may contain confidential and/or privileged
>material. Any review, retransmission, dissemination or other use of, or
>taking of any action in reliance upon, this information by persons or
>entities other than the intended recipient is prohibited. If you
>received this in error, please contact the sender and delete the material
>from any computer.
>
>
>
>
>
>
>
>
>_________________________________________________________________
>The information transmitted is intended only for the person or entity to
>which it is addressed and may contain confidential and/or privileged
>material. Any review, retransmission, dissemination or other use of, or
>taking of any action in reliance upon, this information by persons or
>entities other than the intended recipient is prohibited. If you
>received this in error, please contact the sender and delete the material
>from any computer.
>
>
>
Message #2 by Nikos <pappas@c...> on Wed, 01 Jan 2003 02:44:41 +0200
|
|
Also first you should get the recordcount and then declare the array
dim myarray(RS2.recordcount)
or even better
Set Conn =3D server.Createobject("ADODB.Connection")
Set RS2 =3D server.CreateObject("ADODB.Recordset")
sqlquery =3D "SELECT * FROM CONTRACTS"
Conn.open ("DATABASENAME")
RS2.Open sqlquery, Conn, 1, 3
dim myarray()
myarray =3D RS2.getrows
de reference the rest RS2,Conn etc...
At 11:44 =EC=EC 31/12/2002, you wrote:
>I did that and I still get the error, it says "Subscript out of range:
'11'"
>because the array is already declared at 10 why is my ReDim not working?
>
>-----Original Message-----
>From: kyle.b.willman@u...
>[mailto:kyle.b.willman@u...]
>Sent: Tuesday, December 31, 2002 12:47 PM
>To: ASP Web HowTo
>Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Try:
>
>X=3D0
>
>See whether this will give you the same error...
>
>Kyle B. Willman
>PricewaterhouseCoopers LLP
>Office: xxx.xxx.xxxx
>Cell: xxx.xxx.xxxx
>
>
>
>
>"Lucas Haines" <LucasHaines@a...>
>12/31/2002 01:09 PM
>
>Please respond to "ASP Web HowTo"
>
>
> To: "ASP Web HowTo" <asp_web_howto@p...>
> cc:
> Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>When I do that i get Subscript out of range pointing to
>
> ContractID(X) =3D RS2.Fields("ID")
>
>Any other Ideas?
>
>-----Original Message-----
>From: kyle.b.willman@u...
>[mailto:kyle.b.willman@u...]
>Sent: Tuesday, December 31, 2002 10:40 AM
>To: ASP Web HowTo
>Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Did you try this?
>
>
> Set Conn =3D server.Createobject("ADODB.Connection")
> Set RS2 =3D server.CreateObject("ADODB.Recordset")
> sqlquery =3D "SELECT * FROM CONTRACTS"
> Conn.open ("DATABASENAME")
> RS2.Open sqlquery, Conn, 1, 3
>
> Dim ContractID(10)
> Dim X
>
> ReDim ConractID(RS2.RecordCount)
>
> X =3D 1
>
> DO While NOT RS2.EOF
>
> ContractID(X) =3D RS2.Fields("ID")
> X =3D X + 1
>
> RS2.MoveNext
>
> Loop
>
>Kyle B. Willman
>PricewaterhouseCoopers LLP
>Office: xxx.xxx.xxxx
>Cell: xxx.xxx.xxxx
>
>
>
>
>"Lucas Haines" <LucasHaines@a...>
>12/31/2002 12:31 PM
>
>Please respond to "ASP Web HowTo"
>
>
> To: "ASP Web HowTo" <asp_web_howto@p...>
> cc:
> Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Okay one last time This is it. Here is my code...
>
> Set Conn =3D server.Createobject("ADODB.Connection")
> Set RS2 =3D server.CreateObject("ADODB.Recordset")
> sqlquery =3D "SELECT * FROM CONTRACTS"
> Conn.open ("DATABASENAME")
> RS2.Open sqlquery, Conn, 1, 3
>
> **-Dim ContractID(RS2.RecordCount)
>
> DO While NOT RS2.EOF
> ContractID(RS2.RecordCount) =3D RS2.Fields("ID")
> ReDim ConractID(RS2.RecordCount)
> RS2.MoveNext
>
> Loop
>When i run this script i get a "Expected Integer Constant" pointing to
>"**"
>When i re-write it to "Dim ContractID(25)" ANd run the script I get a Sub
>Script Out of Range error can some one please tell me what i'm doing
>wrong.
>Thank you in adavnce.
>
>Lucas
>
>
>-----Original Message-----
>From: Mark Eckeard [mailto:meckeard2000@y...]
>Sent: Tuesday, December 31, 2002 9:48 AM
>To: ASP Web HowTo
>Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Lucas,
>
>Use:
>
>RS2.recordcount.
>
>Mark
>--- Lucas Haines <LucasHaines@a...> wrote:
> > Thank you Karan. I have one last question what
> > should i use to figure out
> > the max number or records in the recorset to declare
> > the array.
> >
> > "ContractID(RS2.Maxrecords)"?
> >
> > Thank you in advance.
> >
> > Lucas
> >
> > -----Original Message-----
> > From: Karan Bajoria [mailto:karan@t...]
> > Sent: Monday, December 30, 2002 9:14 PM
> > To: ASP Web HowTo
> > Subject: [asp_web_howto] Re: Help me with a simple
> > problem
> >
> >
> > The problem here is that you haven't declared the
> > array.You have to first
> > declare the array
> > Ex : Dim ContractID(10)
> > Then you have to redifine the array size according
> > to the no.of values you
> > want to store in the array.
> > So you may do so
> > Ex: Redim ContractID(RS2.RecordCount)
> > After doing this you will not get a error.
> > Thanks
> > Karan Bajoria
> >
> > ----- Original Message -----
> > From: Lucas Haines <LucasHaines@a...>
> > To: ASP Web HowTo <asp_web_howto@p...>
> > Sent: Tuesday, December 31, 2002 3:40 AM
> > Subject: [asp_web_howto] Help me with a simple
> > problem
> >
> >
> > > Here is my simple problem....
> > >
> > > I have declared an array and everytime i try to
> > input data with a Do Loop
> > > from an SQL database i get a type mismatch error
> > what is the porblem.
> > > **--denotes the error line.
> > >
> > > Set Conn =3D server.Createobject("ADODB.Connection")
> > > Set RS2 =3D server.CreateObject("ADODB.Recordset")
> > > sqlquery =3D "SELECT * FROM CONTRACTS"
> > > Conn.open ("DATABASE NAME")
> > > RS2.Open sqlquery, Conn, 1, 3
> > > count =3D 0
> > >
> > > DO While NOT RS2.EOF
> > > ** ContractID(count) =3D RS2.Fields("ID") **
> > > Response.Write (ContractID(Count))
> > > Count =3D Count + 1
> > > RS2.MoveNext
> > > Loop
> > >
> > > Please get back to me if you know anything or have
> > a suggestion
> > >
> > > Thanks,
> > >
> > > Lucas
> > >
> > >
> >
> >
> >
> >
>
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
>http://mailplus.yahoo.com
>
>
>
>
>
>
>
>
>_________________________________________________________________
>The information transmitted is intended only for the person or entity to
>which it is addressed and may contain confidential and/or privileged
>material. Any review, retransmission, dissemination or other use of, or
>taking of any action in reliance upon, this information by persons or
>entities other than the intended recipient is prohibited. If you
>received this in error, please contact the sender and delete the material
>from any computer.
>
>
>
>
>
>
>
>
>_________________________________________________________________
>The information transmitted is intended only for the person or entity to
>which it is addressed and may contain confidential and/or privileged
>material. Any review, retransmission, dissemination or other use of, or
>taking of any action in reliance upon, this information by persons or
>entities other than the intended recipient is prohibited. If you
>received this in error, please contact the sender and delete the material
>from any computer.
>
>
>
Message #3 by Nikos <pappas@c...> on Wed, 01 Jan 2003 02:52:41 +0200
|
|
This is a working example of get rows method
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<html>
<head>
<title>Get Rows</title>
</head>
<body>
<%
dim objConn, rs, aData, i
set objConn=3Dserver.createobject("adodb.connection")
objConn.open("Provider=3DMicrosoft.Jet.OLEDB.4.0;Data
Source=3D"&server.mappath("fpnwind.mdb"))
set rs =3D objConn.execute("select CustomerID, CompanyName from customers")
aData =3D rs.getrows
rs.close: set rs =3D nothing
objConn.close: set objConn=3Dnothing
response.write "<table>"
for i =3D 0 to ubound(aData,2)
response.write
"<tr><td>"&aData(0,i)&"</td><td>"&aData(1,i)&"</td></tr>"
next
response.write "</table>"
%>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At 09:09 =EC=EC 31/12/2002, you wrote:
>When I do that i get Subscript out of range pointing to
>
> ContractID(X) =3D RS2.Fields("ID")
>
>Any other Ideas?
>
>-----Original Message-----
>From: kyle.b.willman@u...
>[mailto:kyle.b.willman@u...]
>Sent: Tuesday, December 31, 2002 10:40 AM
>To: ASP Web HowTo
>Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Did you try this?
>
>
> Set Conn =3D server.Createobject("ADODB.Connection")
> Set RS2 =3D server.CreateObject("ADODB.Recordset")
> sqlquery =3D "SELECT * FROM CONTRACTS"
> Conn.open ("DATABASENAME")
> RS2.Open sqlquery, Conn, 1, 3
>
> Dim ContractID(10)
> Dim X
>
> ReDim ConractID(RS2.RecordCount)
>
> X =3D 1
>
> DO While NOT RS2.EOF
>
> ContractID(X) =3D RS2.Fields("ID")
> X =3D X + 1
>
> RS2.MoveNext
>
> Loop
>
>Kyle B. Willman
>PricewaterhouseCoopers LLP
>Office: xxx.xxx.xxxx
>Cell: xxx.xxx.xxxx
>
>
>
>
>"Lucas Haines" <LucasHaines@a...>
>12/31/2002 12:31 PM
>
>Please respond to "ASP Web HowTo"
>
>
> To: "ASP Web HowTo" <asp_web_howto@p...>
> cc:
> Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Okay one last time This is it. Here is my code...
>
> Set Conn =3D server.Createobject("ADODB.Connection")
> Set RS2 =3D server.CreateObject("ADODB.Recordset")
> sqlquery =3D "SELECT * FROM CONTRACTS"
> Conn.open ("DATABASENAME")
> RS2.Open sqlquery, Conn, 1, 3
>
> **-Dim ContractID(RS2.RecordCount)
>
> DO While NOT RS2.EOF
> ContractID(RS2.RecordCount) =3D RS2.Fields("ID")
> ReDim ConractID(RS2.RecordCount)
> RS2.MoveNext
>
> Loop
>When i run this script i get a "Expected Integer Constant" pointing to
>"**"
>When i re-write it to "Dim ContractID(25)" ANd run the script I get a Sub
>Script Out of Range error can some one please tell me what i'm doing
>wrong.
>Thank you in adavnce.
>
>Lucas
>
>
>-----Original Message-----
>From: Mark Eckeard [mailto:meckeard2000@y...]
>Sent: Tuesday, December 31, 2002 9:48 AM
>To: ASP Web HowTo
>Subject: [asp_web_howto] Re: Help me with a simple problem
>
>
>Lucas,
>
>Use:
>
>RS2.recordcount.
>
>Mark
>--- Lucas Haines <LucasHaines@a...> wrote:
> > Thank you Karan. I have one last question what
> > should i use to figure out
> > the max number or records in the recorset to declare
> > the array.
> >
> > "ContractID(RS2.Maxrecords)"?
> >
> > Thank you in advance.
> >
> > Lucas
> >
> > -----Original Message-----
> > From: Karan Bajoria [mailto:karan@t...]
> > Sent: Monday, December 30, 2002 9:14 PM
> > To: ASP Web HowTo
> > Subject: [asp_web_howto] Re: Help me with a simple
> > problem
> >
> >
> > The problem here is that you haven't declared the
> > array.You have to first
> > declare the array
> > Ex : Dim ContractID(10)
> > Then you have to redifine the array size according
> > to the no.of values you
> > want to store in the array.
> > So you may do so
> > Ex: Redim ContractID(RS2.RecordCount)
> > After doing this you will not get a error.
> > Thanks
> > Karan Bajoria
> >
> > ----- Original Message -----
> > From: Lucas Haines <LucasHaines@a...>
> > To: ASP Web HowTo <asp_web_howto@p...>
> > Sent: Tuesday, December 31, 2002 3:40 AM
> > Subject: [asp_web_howto] Help me with a simple
> > problem
> >
> >
> > > Here is my simple problem....
> > >
> > > I have declared an array and everytime i try to
> > input data with a Do Loop
> > > from an SQL database i get a type mismatch error
> > what is the porblem.
> > > **--denotes the error line.
> > >
> > > Set Conn =3D server.Createobject("ADODB.Connection")
> > > Set RS2 =3D server.CreateObject("ADODB.Recordset")
> > > sqlquery =3D "SELECT * FROM CONTRACTS"
> > > Conn.open ("DATABASE NAME")
> > > RS2.Open sqlquery, Conn, 1, 3
> > > count =3D 0
> > >
> > > DO While NOT RS2.EOF
> > > ** ContractID(count) =3D RS2.Fields("ID") **
> > > Response.Write (ContractID(Count))
> > > Count =3D Count + 1
> > > RS2.MoveNext
> > > Loop
> > >
> > > Please get back to me if you know anything or have
> > a suggestion
> > >
> > > Thanks,
> > >
> > > Lucas
> > >
> > >
> >
> >
> >
> >
>
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
>http://mailplus.yahoo.com
>
>
>
>
>
>
>
>
>_________________________________________________________________
>The information transmitted is intended only for the person or entity to
>which it is addressed and may contain confidential and/or privileged
>material. Any review, retransmission, dissemination or other use of, or
>taking of any action in reliance upon, this information by persons or
>entities other than the intended recipient is prohibited. If you
>received this in error, please contact the sender and delete the material
>from any computer.
>
>
>
Message #4 by "Paul Beaulieu" <paulbeaulieu@s...> on Wed, 1 Jan 2003 10:32:36 -0500
|
|
What value do you get back for recordcount? I use cursortype=3 and
locktype=3 and the recordcount works but that also locks the records as you
can update them...
Paul.
----- Original Message -----
From: "Nikos" <pappas@c...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Tuesday, December 31, 2002 7:37 PM
Subject: [asp_web_howto] Re: Help me with a simple problem
> try to change the:
> RS2.Open sqlquery, Conn, 1, 3
> to
> RS2.Open sqlquery, Conn, 1, 1
>
> as I thing 3 does not support recordcount
> (not very sure about it but maybe this will help)
>
> happy new year everybody!!!!
>
> At 11:44 μμ 31/12/2002, you wrote:
> >I did that and I still get the error, it says "Subscript out of range:
'11'"
> >because the array is already declared at 10 why is my ReDim not working?
> >
> >-----Original Message-----
> >From: kyle.b.willman@u...
> >[mailto:kyle.b.willman@u...]
> >Sent: Tuesday, December 31, 2002 12:47 PM
> >To: ASP Web HowTo
> >Subject: [asp_web_howto] Re: Help me with a simple problem
> >
> >
> >Try:
> >
> >X=0
> >
> >See whether this will give you the same error...
> >
> >Kyle B. Willman
> >PricewaterhouseCoopers LLP
> >Office: xxx.xxx.xxxx
> >Cell: xxx.xxx.xxxx
> >
> >
> >
> >
> >"Lucas Haines" <LucasHaines@a...>
> >12/31/2002 01:09 PM
> >
> >Please respond to "ASP Web HowTo"
> >
> >
> > To: "ASP Web HowTo" <asp_web_howto@p...>
> > cc:
> > Subject: [asp_web_howto] Re: Help me with a simple
problem
> >
> >
> >When I do that i get Subscript out of range pointing to
> >
> > ContractID(X) = RS2.Fields("ID")
> >
> >Any other Ideas?
> >
> >-----Original Message-----
> >From: kyle.b.willman@u...
> >[mailto:kyle.b.willman@u...]
> >Sent: Tuesday, December 31, 2002 10:40 AM
> >To: ASP Web HowTo
> >Subject: [asp_web_howto] Re: Help me with a simple problem
> >
> >
> >Did you try this?
> >
> >
> > Set Conn = server.Createobject("ADODB.Connection")
> > Set RS2 = server.CreateObject("ADODB.Recordset")
> > sqlquery = "SELECT * FROM CONTRACTS"
> > Conn.open ("DATABASENAME")
> > RS2.Open sqlquery, Conn, 1, 3
> >
> > Dim ContractID(10)
> > Dim X
> >
> > ReDim ConractID(RS2.RecordCount)
> >
> > X = 1
> >
> > DO While NOT RS2.EOF
> >
> > ContractID(X) = RS2.Fields("ID")
> > X = X + 1
> >
> > RS2.MoveNext
> >
> > Loop
> >
> >Kyle B. Willman
> >PricewaterhouseCoopers LLP
> >Office: xxx.xxx.xxxx
> >Cell: xxx.xxx.xxxx
> >
> >
> >
> >
> >"Lucas Haines" <LucasHaines@a...>
> >12/31/2002 12:31 PM
> >
> >Please respond to "ASP Web HowTo"
> >
> >
> > To: "ASP Web HowTo" <asp_web_howto@p...>
> > cc:
> > Subject: [asp_web_howto] Re: Help me with a simple
problem
> >
> >
> >Okay one last time This is it. Here is my code...
> >
> > Set Conn = server.Createobject("ADODB.Connection")
> > Set RS2 = server.CreateObject("ADODB.Recordset")
> > sqlquery = "SELECT * FROM CONTRACTS"
> > Conn.open ("DATABASENAME")
> > RS2.Open sqlquery, Conn, 1, 3
> >
> > **-Dim ContractID(RS2.RecordCount)
> >
> > DO While NOT RS2.EOF
> > ContractID(RS2.RecordCount) = RS2.Fields("ID")
> > ReDim ConractID(RS2.RecordCount)
> > RS2.MoveNext
> >
> > Loop
> >When i run this script i get a "Expected Integer Constant" pointing to
> >"**"
> >When i re-write it to "Dim ContractID(25)" ANd run the script I get a Sub
> >Script Out of Range error can some one please tell me what i'm doing
> >wrong.
> >Thank you in adavnce.
> >
> >Lucas
> >
> >
> >-----Original Message-----
> >From: Mark Eckeard [mailto:meckeard2000@y...]
> >Sent: Tuesday, December 31, 2002 9:48 AM
> >To: ASP Web HowTo
> >Subject: [asp_web_howto] Re: Help me with a simple problem
> >
> >
> >Lucas,
> >
> >Use:
> >
> >RS2.recordcount.
> >
> >Mark
> >--- Lucas Haines <LucasHaines@a...> wrote:
> > > Thank you Karan. I have one last question what
> > > should i use to figure out
> > > the max number or records in the recorset to declare
> > > the array.
> > >
> > > "ContractID(RS2.Maxrecords)"?
> > >
> > > Thank you in advance.
> > >
> > > Lucas
> > >
> > > -----Original Message-----
> > > From: Karan Bajoria [mailto:karan@t...]
> > > Sent: Monday, December 30, 2002 9:14 PM
> > > To: ASP Web HowTo
> > > Subject: [asp_web_howto] Re: Help me with a simple
> > > problem
> > >
> > >
> > > The problem here is that you haven't declared the
> > > array.You have to first
> > > declare the array
> > > Ex : Dim ContractID(10)
> > > Then you have to redifine the array size according
> > > to the no.of values you
> > > want to store in the array.
> > > So you may do so
> > > Ex: Redim ContractID(RS2.RecordCount)
> > > After doing this you will not get a error.
> > > Thanks
> > > Karan Bajoria
> > >
> > > ----- Original Message -----
> > > From: Lucas Haines <LucasHaines@a...>
> > > To: ASP Web HowTo <asp_web_howto@p...>
> > > Sent: Tuesday, December 31, 2002 3:40 AM
> > > Subject: [asp_web_howto] Help me with a simple
> > > problem
> > >
> > >
> > > > Here is my simple problem....
> > > >
> > > > I have declared an array and everytime i try to
> > > input data with a Do Loop
> > > > from an SQL database i get a type mismatch error
> > > what is the porblem.
> > > > **--denotes the error line.
> > > >
> > > > Set Conn = server.Createobject("ADODB.Connection")
> > > > Set RS2 = server.CreateObject("ADODB.Recordset")
> > > > sqlquery = "SELECT * FROM CONTRACTS"
> > > > Conn.open ("DATABASE NAME")
> > > > RS2.Open sqlquery, Conn, 1, 3
> > > > count = 0
> > > >
> > > > DO While NOT RS2.EOF
> > > > ** ContractID(count) = RS2.Fields("ID") **
> > > > Response.Write (ContractID(Count))
> > > > Count = Count + 1
> > > > RS2.MoveNext
> > > > Loop
> > > >
> > > > Please get back to me if you know anything or have
> > > a suggestion
> > > >
> > > > Thanks,
> > > >
> > > > Lucas
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >__________________________________________________
> >Do you Yahoo!?
> >Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> >http://mailplus.yahoo.com
> >
> >
> >
> >
> >
> >
> >
> >
> >_________________________________________________________________
> >The information transmitted is intended only for the person or entity to
> >which it is addressed and may contain confidential and/or privileged
> >material. Any review, retransmission, dissemination or other use of, or
> >taking of any action in reliance upon, this information by persons or
> >entities other than the intended recipient is prohibited. If you
> >received this in error, please contact the sender and delete the material
> >from any computer.
> >
> >
> >
> >
> >
> >
> >
> >
> >_________________________________________________________________
> >The information transmitted is intended only for the person or entity to
> >which it is addressed and may contain confidential and/or privileged
> >material. Any review, retransmission, dissemination or other use of, or
> >taking of any action in reliance upon, this information by persons or
> >entities other than the intended recipient is prohibited. If you
> >received this in error, please contact the sender and delete the material
> >from any computer.
> >
> >
> >
>
>
Message #5 by "Schelling, Michael" <schellim@s...> on Thu, 2 Jan 2003 05:31:20 -0500
|
|
Here's some information on using RecordCount. Hope it helps.
http://www.bann.co.uk/asp/databases/recordcount.asp
http://p2p.wrox.com/archive/pro_vb/2001-12/108.asp
http://support.microsoft.com/default.aspx?scid=3DKB;en-us;q194973
http://grail.cba.csuohio.edu/~matos/notes/ist-331/ADO-DAO-Notes.pdf
RecordCount and arrays
http://p2p.wrox.com/archive/asp_databases/2000-05/21.asp
http://www.adopenstatic.com/experiments/clientsidecursortypes.asp
Mike
-----Original Message-----
From: Paul Beaulieu [mailto:paulbeaulieu@s...]
Sent: Wednesday, January 01, 2003 10:33 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Help me with a simple problem
What value do you get back for recordcount? I use cursortype=3D3 and
locktype=3D3 and the recordcount works but that also locks the records
as you
can update them...
Paul.
----- Original Message -----
From: "Nikos" <pappas@c...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Tuesday, December 31, 2002 7:37 PM
Subject: [asp_web_howto] Re: Help me with a simple problem
> try to change the:
> RS2.Open sqlquery, Conn, 1, 3
> to
> RS2.Open sqlquery, Conn, 1, 1
>
> as I thing 3 does not support recordcount
> (not very sure about it but maybe this will help)
>
> happy new year everybody!!!!
>
> At 11:44 =EC=EC 31/12/2002, you wrote:
> >I did that and I still get the error, it says "Subscript out of
range:
'11'"
> >because the array is already declared at 10 why is my ReDim not
working?
> >
> >-----Original Message-----
> >From: kyle.b.willman@u...
> >[mailto:kyle.b.willman@u...]
> >Sent: Tuesday, December 31, 2002 12:47 PM
> >To: ASP Web HowTo
> >Subject: [asp_web_howto] Re: Help me with a simple problem
> >
> >
> >Try:
> >
> >X=3D0
> >
> >See whether this will give you the same error...
> >
> >Kyle B. Willman
> >PricewaterhouseCoopers LLP
> >Office: xxx.xxx.xxxx
> >Cell: xxx.xxx.xxxx
> >
> >
> >
> >
> >"Lucas Haines" <LucasHaines@a...>
> >12/31/2002 01:09 PM
> >
> >Please respond to "ASP Web HowTo"
> >
> >
> > To: "ASP Web HowTo" <asp_web_howto@p...>
> > cc:
> > Subject: [asp_web_howto] Re: Help me with a simple
problem
> >
> >
> >When I do that i get Subscript out of range pointing to
> >
> > ContractID(X) =3D RS2.Fields("ID")
> >
> >Any other Ideas?
> >
> >-----Original Message-----
> >From: kyle.b.willman@u...
> >[mailto:kyle.b.willman@u...]
> >Sent: Tuesday, December 31, 2002 10:40 AM
> >To: ASP Web HowTo
> >Subject: [asp_web_howto] Re: Help me with a simple problem
> >
> >
> >Did you try this?
> >
> >
> > Set Conn =3D
server.Createobject("ADODB.Connection")
> > Set RS2 =3D server.CreateObject("ADODB.Recordset")
> > sqlquery =3D "SELECT * FROM CONTRACTS"
> > Conn.open ("DATABASENAME")
> > RS2.Open sqlquery, Conn, 1, 3
> >
> > Dim ContractID(10)
> > Dim X
> >
> > ReDim ConractID(RS2.RecordCount)
> >
> > X =3D 1
> >
> > DO While NOT RS2.EOF
> >
> > ContractID(X) =3D RS2.Fields("ID")
> > X =3D X + 1
> >
> > RS2.MoveNext
> >
> > Loop
> >
> >Kyle B. Willman
> >PricewaterhouseCoopers LLP
> >Office: xxx.xxx.xxxx
> >Cell: xxx.xxx.xxxx
> >
> >
> >
> >
> >"Lucas Haines" <LucasHaines@a...>
> >12/31/2002 12:31 PM
> >
> >Please respond to "ASP Web HowTo"
> >
> >
> > To: "ASP Web HowTo" <asp_web_howto@p...>
> > cc:
> > Subject: [asp_web_howto] Re: Help me with a simple
problem
> >
> >
> >Okay one last time This is it. Here is my code...
> >
> > Set Conn =3D
server.Createobject("ADODB.Connection")
> > Set RS2 =3D server.CreateObject("ADODB.Recordset")
> > sqlquery =3D "SELECT * FROM CONTRACTS"
> > Conn.open ("DATABASENAME")
> > RS2.Open sqlquery, Conn, 1, 3
> >
> > **-Dim ContractID(RS2.RecordCount)
> >
> > DO While NOT RS2.EOF
> > ContractID(RS2.RecordCount) =3D RS2.Fields("ID")
> > ReDim ConractID(RS2.RecordCount)
> > RS2.MoveNext
> >
> > Loop
> >When i run this script i get a "Expected Integer Constant" pointing
to
> >"**"
> >When i re-write it to "Dim ContractID(25)" ANd run the script I get
a Sub
> >Script Out of Range error can some one please tell me what i'm doing
> >wrong.
> >Thank you in adavnce.
> >
> >Lucas
> >
> >
> >-----Original Message-----
> >From: Mark Eckeard [mailto:meckeard2000@y...]
> >Sent: Tuesday, December 31, 2002 9:48 AM
> >To: ASP Web HowTo
> >Subject: [asp_web_howto] Re: Help me with a simple problem
> >
> >
> >Lucas,
> >
> >Use:
> >
> >RS2.recordcount.
> >
> >Mark
> >--- Lucas Haines <LucasHaines@a...> wrote:
> > > Thank you Karan. I have one last question what
> > > should i use to figure out
> > > the max number or records in the recorset to declare
> > > the array.
> > >
> > > "ContractID(RS2.Maxrecords)"?
> > >
> > > Thank you in advance.
> > >
> > > Lucas
> > >
> > > -----Original Message-----
> > > From: Karan Bajoria [mailto:karan@t...]
> > > Sent: Monday, December 30, 2002 9:14 PM
> > > To: ASP Web HowTo
> > > Subject: [asp_web_howto] Re: Help me with a simple
> > > problem
> > >
> > >
> > > The problem here is that you haven't declared the
> > > array.You have to first
> > > declare the array
> > > Ex : Dim ContractID(10)
> > > Then you have to redifine the array size according
> > > to the no.of values you
> > > want to store in the array.
> > > So you may do so
> > > Ex: Redim ContractID(RS2.RecordCount)
> > > After doing this you will not get a error.
> > > Thanks
> > > Karan Bajoria
> > >
> > > ----- Original Message -----
> > > From: Lucas Haines <LucasHaines@a...>
> > > To: ASP Web HowTo <asp_web_howto@p...>
> > > Sent: Tuesday, December 31, 2002 3:40 AM
> > > Subject: [asp_web_howto] Help me with a simple
> > > problem
> > >
> > >
> > > > Here is my simple problem....
> > > >
> > > > I have declared an array and everytime i try to
> > > input data with a Do Loop
> > > > from an SQL database i get a type mismatch error
> > > what is the porblem.
> > > > **--denotes the error line.
> > > >
> > > > Set Conn =3D server.Createobject("ADODB.Connection")
> > > > Set RS2 =3D server.CreateObject("ADODB.Recordset")
> > > > sqlquery =3D "SELECT * FROM CONTRACTS"
> > > > Conn.open ("DATABASE NAME")
> > > > RS2.Open sqlquery, Conn, 1, 3
> > > > count =3D 0
> > > >
> > > > DO While NOT RS2.EOF
> > > > ** ContractID(count) =3D RS2.Fields("ID") **
> > > > Response.Write (ContractID(Count))
> > > > Count =3D Count + 1
> > > > RS2.MoveNext
> > > > Loop
> > > >
> > > > Please get back to me if you know anything or have
> > > a suggestion
> > > >
> > > > Thanks,
> > > >
> > > > Lucas
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >__________________________________________________
> >Do you Yahoo!?
> >Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> >http://mailplus.yahoo.com
> >
> >
> >
> >
> >
> >
> >
> >
> >_________________________________________________________________
> >The information transmitted is intended only for the person or
entity to
> >which it is addressed and may contain confidential and/or privileged
> >material. Any review, retransmission, dissemination or other use
of, or
> >taking of any action in reliance upon, this information by persons
or
> >entities other than the intended recipient is prohibited. If you
> >received this in error, please contact the sender and delete the
material
> >from any computer.
> >
> >
> >
> >
> >
> >
> >
> >
> >_________________________________________________________________
> >The information transmitted is intended only for the person or
entity to
> >which it is addressed and may contain confidential and/or privileged
> >material. Any review, retransmission, dissemination or other use
of, or
> >taking of any action in reliance upon, this information by persons
or
> >entities other than the intended recipient is prohibited. If you
> >received this in error, please contact the sender and delete the
material
> >from any computer.
> >
> >
> >
>
>
|
|
 |