Solved

DSNless Connection String

Posted on 2007-03-23
10
299 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
edit .asp files 5 48
IIS components 2 35
send email part1 9 40
StoredProcedure to JSON query faulty syntax 2 29
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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