Solved

DSNless Connection String

Posted on 2007-03-23
10
300 Views
Last Modified: 2010-04-25
I am attempting a DSNless connection to an Access Database.  Here is the connection string:
<%
var MM_NCIMHC2_STRING = strConnection = "DBQ=" & server.mappath("\CS\NCIMHC\Database\NCIMHC.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"
%>
This resides on an ASP page in the connections folder and is called NCIMHC2.asp

The asp code to connect to the databse using the DSNless sting is as follows:
<!--#include virtual="/CS/Connections/NCIMHC2.asp" -->
<%
var Recordset1 = Server.CreateObject("ADODB.Recordset");
Recordset1.ActiveConnection = MM_NCIMHC2_STRING;
Recordset1.Source = "SELECT * FROM NCIMHC";
Recordset1.CursorType = 0;
Recordset1.CursorLocation = 2;
Recordset1.LockType = 1;
Recordset1.Open();
var Recordset1_numRows = 0;
%>

I get the following error:

Microsoft JScript runtime error '800a1391'

'server' is undefined

/CS/Connections/NCIMHC2.asp, line 2

I assume this has to do with the sever.mappath in the connection string but am unclear as to why.  I appreciate your wisdom and wil award accordingly.
0
Comment
Question by:bleckron
[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
  • 4
  • 4
10 Comments
 
LVL 15

Expert Comment

by:Colosseo
ID: 18780184
Hello

I could be wrong but does server not have to be uppercase ie Server

also this is not a valid string

var MM_NCIMHC2_STRING = strConnection = "DBQ=" & server.mappath("\CS\NCIMHC\Database\NCIMHC.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"

Scott
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 18780192
actually it might be valid i think i read it wrong

sorry

Scott
0
 

Author Comment

by:bleckron
ID: 18780506
Ihave now changed the connection string to :

<%
var MM_NCIMHC2_STRING = "DBQ=" & Server.MapPath("\CS\NCIMHC\Database\NCIMHC.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"
%>

And now get the following error:

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/CS/NCIMHC/Test.asp, line 5
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:Colosseo
ID: 18780540
A good reference for connection strings:

http://www.connectionstrings.com/

in particular

http://www.connectionstrings.com/?carrier=access

try that as an example

Scott
0
 

Author Comment

by:bleckron
ID: 18780886
I tried the examples to no avail...
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 18780903
try doing a response.write on MM_NCIMHC2_STRING just to see what is getting set
0
 

Author Comment

by:bleckron
ID: 18781627
I get a "0".  I t must not be getting to the databse.  The conection sstring must not be right somehow?
0
 

Author Comment

by:bleckron
ID: 18782297
I figured it out:

<%
 FileName="Connection_ado_conn_string.htm"
 Type="ADO"
 DesigntimeType="ADO"
 HTTP="true"
 Catalog=""
 Schema=""
var MM_NCIMHC_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ Server.MapPath("/CS/NCIMHC/Database/NCIMHC.mdb")
%>

I am using Javascript so needed to use DSNless connectin with Javascript.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 19230120
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

729 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