473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

error with javascript in ASP

Hi,

Maybe not the right newsgroup, but it's an ASP problem, so ..

This ASP file works fine with vbscript:
<%
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=msdasql; driver={microsoft access driver (*.mdb)};
dbq=d:\access\newres.mdb")
sql="select dag, aantalu from daguur;"
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql, objdc, 3, 3
rec=rs.recordcount
rs.movefirst
da=rs.Fields("dag").Value
aanu=rs.Fields("aantalu").Value
....
%>
But how to translate this in Javascript? I tried this but ger the error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open
registry key 'Temporary (volatile) Jet DSN for process 0x4a8 Thread 0x6e8
DBC 0x227335c Jet'.
/respen/newres/testj.asp, line 4

<%@ language=javascript %>
<%
var objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=msdasql; driver={microsoft access driver (*.mdb)};
dbq=d:\access\newres.mdb")
sql="select dag, aantalu from daguur;"
var rs=Server.CreateObject("ADODB.Recordset")
rs.Open("sql, objdc, 3, 3")
rec=rs.recordcount
rs.movefirst
da=rs.Fields("dag").Value
aanu=rs.Fields("aantalu").Value
%>

Thanks
Andre

Jul 19 '05 #1
11 1924


andre wrote:

Maybe not the right newsgroup, but it's an ASP problem, so ..

This ASP file works fine with vbscript:
<%
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=msdasql; driver={microsoft access driver (*.mdb)};
dbq=d:\access\newres.mdb")
sql="select dag, aantalu from daguur;"
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql, objdc, 3, 3
rec=rs.recordcount
rs.movefirst
da=rs.Fields("dag").Value
aanu=rs.Fields("aantalu").Value
...
%>
But how to translate this in Javascript? I tried this but ger the error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open
registry key 'Temporary (volatile) Jet DSN for process 0x4a8 Thread 0x6e8
DBC 0x227335c Jet'.
/respen/newres/testj.asp, line 4

<%@ language=javascript %>
<%
var objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=msdasql; driver={microsoft access driver (*.mdb)};
dbq=d:\access\newres.mdb")
sql="select dag, aantalu from daguur;"
var rs=Server.CreateObject("ADODB.Recordset")
rs.Open("sql, objdc, 3, 3")
You are passing a string argument to Open which is nonsense, you simply need
rs.Open(sql, objdc, 3, 3);
rec=rs.recordcount
rs.movefirst


Make that
rs.movefirst();
where maybe you even need different casing
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 19 '05 #2
andre wrote:
Hi,

Maybe not the right newsgroup, but it's an ASP problem, so ..

This ASP file works fine with vbscript:
<%
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=msdasql; driver={microsoft access driver
(*.mdb)}; dbq=d:\access\newres.mdb")
sql="select dag, aantalu from daguur;"
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql, objdc, 3, 3
rec=rs.recordcount
rs.movefirst
da=rs.Fields("dag").Value
aanu=rs.Fields("aantalu").Value
...
%>
But how to translate this in Javascript? I tried this but ger the
error: Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open
registry key 'Temporary (volatile) Jet DSN for process 0x4a8 Thread
0x6e8 DBC 0x227335c Jet'.
/respen/newres/testj.asp, line 4


Martin dealt with the problem in your rs.open line, but that does not
address this problem which is caused by your use of the msdasql provider
instead of the native Jet OLEDB provider. Your connection string should be:

"provider=Microsoft.Jet.OLEDB.4.0; Data Source =d:\access\newres.mdb"

If you think you really need to use the deprecated msdasql provider for some
reason, then check out this article:
http://www.aspfaq.com/show.asp?id=2009

which should lead you to this KB article:
http://support.microsoft.com/?kbid=315456

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3
Thanks both for replying.
I change both things but now i get:
Microsoft JET Database Engine (0x80004005)
Not a valid file name.
/respen/newres/testj.asp, line 4

I went to the site you referenced, but could not find that error.
This works with VB, maybe the syntax is somewhere wrong for javascript?

Thanks again
Andre

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
andre wrote:
Hi,

Maybe not the right newsgroup, but it's an ASP problem, so ..

This ASP file works fine with vbscript:
<%
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=msdasql; driver={microsoft access driver
(*.mdb)}; dbq=d:\access\newres.mdb")
sql="select dag, aantalu from daguur;"
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql, objdc, 3, 3
rec=rs.recordcount
rs.movefirst
da=rs.Fields("dag").Value
aanu=rs.Fields("aantalu").Value
...
%>
But how to translate this in Javascript? I tried this but ger the
error: Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open
registry key 'Temporary (volatile) Jet DSN for process 0x4a8 Thread
0x6e8 DBC 0x227335c Jet'.
/respen/newres/testj.asp, line 4

Martin dealt with the problem in your rs.open line, but that does not
address this problem which is caused by your use of the msdasql provider
instead of the native Jet OLEDB provider. Your connection string should

be:
"provider=Microsoft.Jet.OLEDB.4.0; Data Source =d:\access\newres.mdb"

If you think you really need to use the deprecated msdasql provider for some reason, then check out this article:
http://www.aspfaq.com/show.asp?id=2009

which should lead you to this KB article:
http://support.microsoft.com/?kbid=315456

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #4
This is likely to be a permissions issue (which is covered at the site to
which I linked.) ASP runs under the Internet Guest account
(IUSR_MachineName). This account needs to be granted Change permissions for
the folder containing the database file.

Bob Barrows

andre wrote:
Thanks both for replying.
I change both things but now i get:
Microsoft JET Database Engine (0x80004005)
Not a valid file name.
/respen/newres/testj.asp, line 4

I went to the site you referenced, but could not find that error.
This works with VB, maybe the syntax is somewhere wrong for
javascript?

Thanks again
Andre

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #5
Sorry, but it still doesn't work (same error).
All the permissions of that directory are set to 'everyone'. I added all
permissions for IUSR_.

If that was the problem, the same ASP file with VB wouldn't work either, or
am i wrong?

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
This is likely to be a permissions issue (which is covered at the site to
which I linked.) ASP runs under the Internet Guest account
(IUSR_MachineName). This account needs to be granted Change permissions for the folder containing the database file.

Bob Barrows

andre wrote:
Thanks both for replying.
I change both things but now i get:
Microsoft JET Database Engine (0x80004005)
Not a valid file name.
/respen/newres/testj.asp, line 4

I went to the site you referenced, but could not find that error.
This works with VB, maybe the syntax is somewhere wrong for
javascript?

Thanks again
Andre

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #6
It doesn't need to be set to everyone. It needs to be set for the IUSR
account. If d: is a mapped network drive, IUSR will not have permission to
"see" it.
VB does not run under the IUSR account, it runs under the account of the
person who launched the VB application. ASP is a "server" application - it
does not run under the account of the person who made the request to the ASP
page, unless ASP is set to impersonate a specific account.

In addition, if the IIS application is set to run under medium or higher
security, then it's the IWAM account, not the IUSR, that will need
permissions for that folder.

andre wrote:
Sorry, but it still doesn't work (same error).
All the permissions of that directory are set to 'everyone'. I added
all permissions for IUSR_.

If that was the problem, the same ASP file with VB wouldn't work
either, or am i wrong?

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
This is likely to be a permissions issue (which is covered at the
site to which I linked.) ASP runs under the Internet Guest account
(IUSR_MachineName). This account needs to be granted Change
permissions for the folder containing the database file.

Bob Barrows

andre wrote:
Thanks both for replying.
I change both things but now i get:
Microsoft JET Database Engine (0x80004005)
Not a valid file name.
/respen/newres/testj.asp, line 4

I went to the site you referenced, but could not find that error.
This works with VB, maybe the syntax is somewhere wrong for
javascript?

Thanks again
Andre

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #7
Hi Bob,

I feel uncomfortable for your time, but there is still a problem somewhere.
I run IIS 5.0 on windows 2000 server (no domain). The directory containing
the Access file is on a NTFS file and i put all the permissions also to
IWAM. I put the Application Protection of IIS to low.
I even tried with another FAT32 disc, where it's not possible to set
permission. Nothing to do: always:
Microsoft JET Database Engine (0x80004005)
Not a valid file name.
It's crazy ...
Thanks anyway ...


"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
It doesn't need to be set to everyone. It needs to be set for the IUSR
account. If d: is a mapped network drive, IUSR will not have permission to
"see" it.
VB does not run under the IUSR account, it runs under the account of the
person who launched the VB application. ASP is a "server" application - it
does not run under the account of the person who made the request to the ASP page, unless ASP is set to impersonate a specific account.

In addition, if the IIS application is set to run under medium or higher
security, then it's the IWAM account, not the IUSR, that will need
permissions for that folder.

andre wrote:
Sorry, but it still doesn't work (same error).
All the permissions of that directory are set to 'everyone'. I added
all permissions for IUSR_.

If that was the problem, the same ASP file with VB wouldn't work
either, or am i wrong?

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
This is likely to be a permissions issue (which is covered at the
site to which I linked.) ASP runs under the Internet Guest account
(IUSR_MachineName). This account needs to be granted Change
permissions for the folder containing the database file.

Bob Barrows

andre wrote:
Thanks both for replying.
I change both things but now i get:
Microsoft JET Database Engine (0x80004005)
Not a valid file name.
/respen/newres/testj.asp, line 4

I went to the site you referenced, but could not find that error.
This works with VB, maybe the syntax is somewhere wrong for
javascript?

Thanks again
Andre

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #8
"andre" wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
: <%
: set objdc = Server.CreateObject("ADODB.Connection")
: objdc.Open("provider=msdasql; driver={microsoft access driver (*.mdb)};
: dbq=d:\access\newres.mdb")
: sql="select dag, aantalu from daguur;"
: set rs=Server.CreateObject("ADODB.Recordset")
: rs.Open sql, objdc, 3, 3
: rec=rs.recordcount
: rs.movefirst
: da=rs.Fields("dag").Value
: aanu=rs.Fields("aantalu").Value
: ...
: %>

I'm not sure what the case is since I only use Javascript on the
clients-side but I see several potential problems and this is untested.

1. Provider
2. \\ Escaping paths
3. CreateObject vs ActiveXObject
4. rs.Fields.Item(...).Value
5. J(ava)Script is case-sensitive so some commands might need to be
modified.

<%@ Language="JScript" %>
<%
var objdc = new ActiveXObject("ADODB.Connection");
var connstr = "provider=Microsoft.Jet.OLEDB.4.0; Data Source
=d:\\access\\newres.mdb";
objdc.Open(connstr);
var sql = "select dag, aantalu from daguur";
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open(sql, objdc, 3, 3);
var rec = rs.recordCount;
rs.moveFirst();
var da = rs.Fields.Item("dag").Value;
var aanu = rs.Fields.Item("aantalu").Value;
....
%>

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 19 '05 #9
andre wrote:
Hi Bob,

I feel uncomfortable for your time, but there is still a problem
somewhere. I run IIS 5.0 on windows 2000 server (no domain). The
directory containing the Access file is on a NTFS file and i put all
the permissions also to IWAM. I put the Application Protection of IIS
to low.
I even tried with another FAT32 disc, where it's not possible to set
permission. Nothing to do: always:
Microsoft JET Database Engine (0x80004005)
Not a valid file name.
It's crazy ...
Thanks anyway ...


See Roland's reply. I think he's spotted the problem: I forgot you needed to
escape the backslashes in the path string in javascript. I should have
advised you to use response.write to verify that the connection string was
correct.

var sConnect = "Provider=...."
Response.Write(sConnect)

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #10
Thanks, it works now.
The only thing i had to change was \\

"Roland Hall" <nobody@nowhere> wrote in message
news:eg**************@TK2MSFTNGP11.phx.gbl...
"andre" wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
: <%
: set objdc = Server.CreateObject("ADODB.Connection")
: objdc.Open("provider=msdasql; driver={microsoft access driver (*.mdb)};
: dbq=d:\access\newres.mdb")
: sql="select dag, aantalu from daguur;"
: set rs=Server.CreateObject("ADODB.Recordset")
: rs.Open sql, objdc, 3, 3
: rec=rs.recordcount
: rs.movefirst
: da=rs.Fields("dag").Value
: aanu=rs.Fields("aantalu").Value
: ...
: %>

I'm not sure what the case is since I only use Javascript on the
clients-side but I see several potential problems and this is untested.

1. Provider
2. \\ Escaping paths
3. CreateObject vs ActiveXObject
4. rs.Fields.Item(...).Value
5. J(ava)Script is case-sensitive so some commands might need to be
modified.

<%@ Language="JScript" %>
<%
var objdc = new ActiveXObject("ADODB.Connection");
var connstr = "provider=Microsoft.Jet.OLEDB.4.0; Data Source
=d:\\access\\newres.mdb";
objdc.Open(connstr);
var sql = "select dag, aantalu from daguur";
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open(sql, objdc, 3, 3);
var rec = rs.recordCount;
rs.moveFirst();
var da = rs.Fields.Item("dag").Value;
var aanu = rs.Fields.Item("aantalu").Value;
...
%>

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp MSDN Library - http://msdn.microsoft.com/library/default.asp

Jul 19 '05 #11
"andre" wrote in message news:%2***************@TK2MSFTNGP12.phx.gbl...
: Thanks, it works now.
: The only thing i had to change was \\

Well, the only thing now, right? Hopefully you have already changed your
provider to OLEDB from the previous posts you received, possibly other
things, like what Martin pointed out where you were using a string literal.
Also, as Bob pointed out, you only need 'change' rights, not full rights for
the IUSR account for the folder where the db resides.

rs("somevariable") will also work but it is not the suggested format to use.

Bob pointed the most important thing here. It is ALWAYS a good idea to
write your responses to the screen to verify what you're getting is what
you're expecting. This could have shown you:

provider=Microsoft.Jet.OLEDB.4.0; Data Source=d:accessnewres.mdb

....which is probably what you were getting... Most of us use VBScript for
ASP coding so "provider=Microsoft.Jet.OLEDB.4.0; Data
Source=d:\access\newres.mdb" is appropriate and easily overlooked when
someone is using J(ava)Script.

Glida Radner, as Rosanna Rosanna Danna, said it best, "That just goes to
show ya'. It's always something." (O:=

Glad you got it working.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 19 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Geoff Cox | last post by:
Hello, One person to date has received a runtime error message saying "parent.frameleft.location is not an object" with the following code. The code is used to select 2 frames at the same...
1
by: questionr | last post by:
There is a spell checker function which is written in VB Script. The function works well when tested seperately. But when the function is called from Java Script, the function shows an Error saying...
2
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
1
by: Joe | last post by:
I have created a web application using C#. I have done several web based apps in C# and have not had this problem before. I think this may be a defect in the VisualSutdio.net2003. I am using a...
11
by: westplastic | last post by:
This one is driving me insane. The script works perfect on Firefox, but Internet Explorer keeps complaining about "Error Object Expected" and stuff like that. I've run it through Firefox's Java...
39
by: eruanion | last post by:
Hi, I've been working on this for a while now and I can't seem to find out what is wrong with my code. I have 2 files one c3common.js which only contains javascript functions for my main html page...
9
by: VancouverMike | last post by:
Hi there, I run into a very strange problem. I got the following url and am passing information via query string. The problem when the "sin" key in query string is blank, shown as in the...
11
by: TJM | last post by:
Hi, A Javascript error is generated when the user types a few character in an INPUT TYPE=FILE and hits a submit button. The form does not post. Is there a solution to this problem? Thanks TJM
1
by: JumpingOffPlace | last post by:
Hi, I'm hoping that the wealth of knowledge here can stop me from spinning my wheels on this syntax error for hours. :) Below is the code, and the error I am recieving.... Code: <!DOCTYPE...
8
by: Taras_96 | last post by:
Hi everyone, We' ve come to the conclusion that we wish the user to be directed to an error page if javascript is disabled <enter comment about how a webpage shouldn't rely on javascript here :)...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.