Link to home
Start Free TrialLog in
Avatar of Will
WillFlag for United States of America

asked on

New to getrows getting type mismatch error on dsn

I am using the following vbscript in asp

<%@ Language=VBScript%>

<%dim fac_array
SET DbObj = CreateObject("ADODB.recordset") 'set up the


'ADO connection
''DbObj.Open "DSN=ERS","xxx","xxxxx"           'line 9

strSQL="select rcsql.dbo.facilities.* from rcsql.dbo.facilities"


SET oRs = DbObj.execute(strSQL)

fac_array=oRs.getrows(1,1)


DbObj.Close 'Close the database connection
SET DbObj = Nothing 'Clean up after yourself


response.write (fac_array(10,1))%>


I get the following error:

Type mismatch.

/getrow.asp, line 9


I supsect I am using the wrong connection?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Will

ASKER

Thanks you both.  I made the corrections and now get the following error:


The connection cannot be used to perform this operation. It is either closed or invalid in this context.

/getrow.asp, line 9
Amend this line
SET DbObj = CreateObject("ADODB.recordset")

to

SET DbObj = CreateObject("ADODB.Connection")


Have you created a DSN called ERS?

DSN-less connections are actually better - see here
http://www.w3schools.com/ado/ado_connect.asp
If you want to stay with DSN then heres a tutorial
http://www.devasp.com/samples/dsn.asp
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial