Solved

SQL Server 2008 GetRows Error

Posted on 2013-11-17
2
496 Views
Last Modified: 2013-11-17
Trying to implement getrows for the first time and i am getting a type mismatch error:

Line: 94
Column: -1
Source:
Description: Type mismatch
Err #:
Com Err #: -2146828275
Category: Microsoft VBScript runtime

Here is where the error is occurring:
ReDim Preserve PartArray(11, 0)			
If lRaceID = "0" Then
	i = 0
'	For k = 0 to UBound(Races, 2) - 1
		Set rs = Server.CreateObject("ADODB.Recordset")
		sql="SELECT p.ParticipantID, p.FirstName, p.LastName, rc.Bib, p.Gender, rc.Age, p.City, p.St, p.Phone, p.DOB, p.Email, rg.RaceID FROM "
		sql = sql & "Participant p INNER JOIN PartReg rg ON p.ParticipantID = rg.ParticipantID JOIN PartRace rc "
		sql = sql & "ON rc.ParticipantID = p.ParticipantID WHERE rc.RaceID IN (" & sEventRaces & ") " & sOrderBy
		rs.Open sql, conn, 1, 2
        PartArray=rs.GetRows()		
        rs.Close
		Set rs=Nothing
'	Next

Open in new window


I have fiddled with the ReDim, etc and continue to get errors.
0
Comment
Question by:Bob Schneider
2 Comments
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 200 total points
ID: 39654714
Which line does the error refer to?

Get rid of, "ReDim Preserve PartArray(11, 0)      "

What is the purpose of the for next statement?  Are you trying to create multiple arrays?
0
 
LVL 33

Accepted Solution

by:
Big Monty earned 300 total points
ID: 39654717
No need to redim the array. Just do

Dim PartArray

Using GetRows well automatically size the array for you, no need to set the size of it
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
alert(innerHTML); 8 33
SQL - format decimal in a string 5 40
sql 2016 Integration Service connecting to 2012 3 33
sql2016-WIn10: standard,for SQL servc-account.. 51 31
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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