Solved

New to getrows  getting type mismatch error on dsn

Posted on 2006-10-25
6
482 Views
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)

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
0
Comment
Question by:wkrasner
6 Comments
 
LVL 58

Accepted Solution

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

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

Assisted Solution

by:b0lsc0tt
b0lsc0tt earned 100 total points
ID: 17805366
wkrasner,

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.

b0lsc0tt
0
 
LVL 5

Author Comment

by:wkrasner
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
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 58

Expert Comment

by:Gary
ID: 17806080
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
0
 
LVL 58

Expert Comment

by:Gary
ID: 17806097
If you want to stay with DSN then heres a tutorial
http://www.devasp.com/samples/dsn.asp
0
 
LVL 12

Assisted Solution

by:ullfindsmit
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)

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))%>

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now