Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSN less javascript for ASP does anyone konws how?

Status
Not open for further replies.

Almarton

Programmer
Jan 1, 2002
42
BR
Hi all,

I would like to know how to write code for a DSN
less connection to my DB in (Javascript) because
with VB Script I know to be:

--------------------------------------------------

Set conXML = Server.CreateObject("ADODB.Connection")
conXML.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("FMMLProjects.mdb"))

------------------------------------------------

But the ASP page that I am using is all in javascript
and some of the routines there I could not translate
to VB Script. So I need a DSN-less code fragment
written in javascript.

Can anyone help?


Many Thanx and Regards;
@lmarton
Alexandre @lmarton Marton
almarton@task.com.br
Alexandre @lmarton Marton
almarton@task.com.br
 
var conXML = Server.CreateObject("ADODB.Connection");

conXML.Open("Your Conn String");
if (conXML.State == 1) {
// Congrats. You connected.
conXML.Close;
} else {
// Could not connect
} Jon Hawkins
 
Dear


I've tried your suggestion with hope, but it does not work,
what I have already running in my IIS Server has the
following - DSN connection - code:


//ESTABLISH A GLOBAL CONNECTION
dbConn = Server.CreateObject("ADODB.Connection");
dbConn.Open("FMMLProjects", "", "");
dbRecordSet = Server.CreateObject("ADODB.RecordSet");


As you see it takes the DSN FMMLProjects and
can communicate with the DB.

But if I get rid of the DSN and try to connect as
you suggested either using virtual path:

dbConn.Open(" "", "");

or

dbConn.Open("FMMLQueryDB/FMMLProjects.mdb", "", "");



or even the fisical path

dbConn.Open("d:\unzip\FMMLProjects.mdb", "", "");


IT DOES NOT WORK AT ALL!!!
The only way for it to work is using the first code
I quoted but it is a DSN connection and I need a DSN-less
cause my Web Host does not use DSN.

The string you refered
to is that (path) isnt it, if not which is?

Do you have any other suggestion?
How to do it with Javascript? Anyone knows how?

Help pleezzz....


@lmarton
Alexandre M P Santos
BRAZIL
almarton@task.com.br

Alexandre @lmarton Marton
almarton@task.com.br
 
The connection string isnt going to vary between VBS & JS. If you choose to have your code build the connection string (as per your first example using the mappath method), the syntax to do that will vary.

Try:

dbConn.Open("Provider=MSDASQL.1;Driver={Microsoft Access Driver (*.mdb)};DBQ=d:\unzip\FMMLProjects.mdb;UID=;PWD=;");

or

dbConn.Open("Provider=MSDASQL.1;Driver={Microsoft Access Driver (*.mdb)};DBQ=d:\unzip\FMMLProjects.mdb;","",""); Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top