|
 |
asp_web_howto thread: Help me with a simple problem
Message #1 by "Lucas Haines" <LucasHaines@a...> on Mon, 30 Dec 2002 14:10:37 -0800
|
|
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
Message #2 by "Karan Bajoria" <karan@t...> on Tue, 31 Dec 2002 10:43:54 +0530
|
|
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
>
>
|
|
 |