Will
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.record set") '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
<%@ Language=VBScript%>
<%dim fac_array
SET DbObj = CreateObject("ADODB.record
'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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Amend this line
SET DbObj = CreateObject("ADODB.record set")
to
SET DbObj = CreateObject("ADODB.Connec tion")
Have you created a DSN called ERS?
DSN-less connections are actually better - see here
http://www.w3schools.com/ado/ado_connect.asp
SET DbObj = CreateObject("ADODB.record
to
SET DbObj = CreateObject("ADODB.Connec
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
http://www.devasp.com/samples/dsn.asp
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/getrow.asp, line 9