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
Solved

DSNless Connection String

Posted on 2007-03-23
10
298 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
  • 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
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.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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
how to hide hopscotch tour popup page reload? 2 94
Pass through dll 2 91
Html Table Looping (part 2) 5 27
Time comparison asp 1 9
For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 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