Solved

SQL Server 2008 GetRows Error

Posted on 2013-11-17
2
497 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

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
Debugging Html 8 41
Html split(text) 2 48
Cannot connect to SQL express 2008 R2 installed on Server 2016 5 49
Classic ASP - Display returned sql output parameter 9 54
Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

737 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