New to getrows  getting type mismatch error on dsn

Posted on 2006-10-25
Last Modified: 2009-12-16
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)


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?

Question by:wkrasner
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
LVL 58

Accepted Solution

Gary earned 300 total points
ID: 17805357
This is how it should look

DbObj.Open "DSN=MyDSN;UID=Admin;PWD=Test"
LVL 54

Assisted Solution

b0lsc0tt earned 100 total points
ID: 17805366

Is the double quote mark on that line (line 9) a typo?  If not that command should not start with a double quote.  Also what are the other values?  If they are part of the connection string then it is all one string and should look like this ...

DbObj.Open "DSN=ERS;UID=xxx;Password=xxxxx"           'line 9

Let me know how this helps.  Let me know if you have any questions or need more information.


Author Comment

ID: 17805987
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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

LVL 58

Expert Comment

ID: 17806080
Amend this line
SET DbObj = CreateObject("ADODB.recordset")


SET DbObj = CreateObject("ADODB.Connection")

Have you created a DSN called ERS?

DSN-less connections are actually better - see here
LVL 58

Expert Comment

ID: 17806097
If you want to stay with DSN then heres a tutorial
LVL 12

Assisted Solution

ullfindsmit earned 100 total points
ID: 17806710
<%dim fac_array
SET DbObj = Server.CreateObject("ADODB.Connection") 'set up the

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

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

Set oRs = Server.CreateObject("ADODB.recordset")
oRs = DbObj.execute(strSQL)


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

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


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Server Timeout with Loop 6 63
Save ms data to server side. 19 63
Select case on click 3 30
Html value of radio 14 53
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

732 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