weird error, don"t know why
weird error, don"t know why
am 24.11.2004 10:39:55 von Philmans
Hi all,
What's wrong with the code below?
Everything is working fine except the Addnew and the Update lines?
All names and paths are correct, when i just read the database there's no
problem, it occurs when i want to add/update something.
I checked the same code back in Visual Basic and there no problem at all.
Could somebody please help me out?
Code listing:
<%
dim sfirstname
dim slastname
sfirstname = request.form("firstname")
slastname = request.form("lastname")
dim cnReq
dim strConn
dim rsReq
dim strSQL
Set cnReq = Server.CreateObject("ADODB.Connection")
strConn = "Provider=MICROSOFT.JET.OLEDB.4.0; " & "DATA SOURCE=" &
Server.MapPath("databases/requests.mdb") & ";"
cnReq.open strConn
Set rsReq = Server.CreateObject("ADODB.Recordset")
rsReq.CursorType = 2
rsReq.LockType = 3
strSQL = "SELECT top 1 * FROM tblRequest;"
rsReq.Open strSQL, cnReq
if rsReq.eof then
rsReq.addnew
rsReq.fields("strRemarks")="blablablabla..."
rsReq.fields("dtmDate")=now
rsReq.update
else
rsReq.fields("dtmDate")=now
rsReq.update
end if
rsReq.close
cnReq.close
set cnReq = nothing
%>
Re: weird error, don"t know why
am 24.11.2004 15:23:03 von reb01501
Philmans wrote:
> Hi all,
>
> What's wrong with the code below?
> Everything is working fine except the Addnew and the Update lines?
While AddNew and Update may be efficient in VB, they are very inefficient in
ASP. You should be using saved parameter queries to do your inserts and
updates. See:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=eHYxOyvaDHA.4020%40tk2msftngp13.phx.gbl
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=ukS%246S%247CHA.2464%40TK2MSFTNGP11.phx.gbl
http://www.google.com/groups?selm=eETTdnvFDHA.1660%40TK2MSFT NGP10.phx.gbl&oe=UTF-8&output=gplain
>
> All names and paths are correct, when i just read the database
> there's no problem, it occurs when i want to add/update something.
What occurs??? We're not looking over your shoulder. You need to tell us
what your symptoms are if we are to have any chance at all of diagnosing
your problem.
As a guess, I suspect you are experiencing permissions issues. Your IUSR
account (Internet Guest Account) requires read/write permissions on the
folder containing your database (not just the mdb file - the entire folder).
See
http://www.aspfaq.com/show.asp?id=2009
http://www.aspfaq.com/show.asp?id=2062
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: weird error, don"t know why
am 24.11.2004 16:31:07 von JohnDpatriot
Bob Barrows [MVP] wrote:
> Philmans wrote:
>
>>Hi all,
>>
>>What's wrong with the code below?
>>Everything is working fine except the Addnew and the Update lines?
>
>
> While AddNew and Update may be efficient in VB, they are very inefficient in
> ASP. You should be using saved parameter queries to do your inserts and
> updates. See:
>
>
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=eHYxOyvaDHA.4020%40tk2msftngp13.phx.gbl
>
>
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=ukS%246S%247CHA.2464%40TK2MSFTNGP11.phx.gbl
>
> http://www.google.com/groups?selm=eETTdnvFDHA.1660%40TK2MSFT NGP10.phx.gbl&oe=UTF-8&output=gplain
>
>
>>All names and paths are correct, when i just read the database
>>there's no problem, it occurs when i want to add/update something.
>
>
> What occurs??? We're not looking over your shoulder. You need to tell us
> what your symptoms are if we are to have any chance at all of diagnosing
> your problem.
>
> As a guess, I suspect you are experiencing permissions issues. Your IUSR
> account (Internet Guest Account) requires read/write permissions on the
> folder containing your database (not just the mdb file - the entire folder).
> See
> http://www.aspfaq.com/show.asp?id=2009
> http://www.aspfaq.com/show.asp?id=2062
>
> Bob Barrows
>
Bob,
Would it be equally innefficient to write the adds/updates as SQL and
execute them ?
ie.
STRSQL = "INSERT INTO TBLREQUEST (strRemarks) USING ('blablablabla...')"
Set objRS = strConn.Execute(STRSQL)
Re: weird error, don"t know why
am 24.11.2004 17:20:52 von reb01501
JohnDpatriot wrote:
> Bob Barrows [MVP] wrote:
>> Philmans wrote:
>>
>>> Hi all,
>>>
>>> What's wrong with the code below?
>>> Everything is working fine except the Addnew and the Update lines?
>>
>>
>> While AddNew and Update may be efficient in VB, they are very
>> inefficient in ASP. You should be using saved parameter queries to
>> do your inserts and updates. See:
>>
>>
>>
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=eHYxOyvaDHA.4020%40tk2msftngp13.phx.gbl
>>
>>
>>
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=ukS%246S%247CHA.2464%40TK2MSFTNGP11.phx.gbl
>>
>>
http://www.google.com/groups?selm=eETTdnvFDHA.1660%40TK2MSFT NGP10.phx.gbl&oe=UTF-8&output=gplain
>>
>>
>>> All names and paths are correct, when i just read the database
>>> there's no problem, it occurs when i want to add/update something.
>>
>>
>> What occurs??? We're not looking over your shoulder. You need to
>> tell us what your symptoms are if we are to have any chance at all
>> of diagnosing your problem.
>>
>> As a guess, I suspect you are experiencing permissions issues. Your
>> IUSR account (Internet Guest Account) requires read/write
>> permissions on the folder containing your database (not just the mdb
>> file - the entire folder). See
>> http://www.aspfaq.com/show.asp?id=2009
>> http://www.aspfaq.com/show.asp?id=2062
>>
>> Bob Barrows
>>
> Bob,
>
> Would it be equally innefficient to write the adds/updates as SQL and
> execute them ?
>
> ie.
>
> STRSQL = "INSERT INTO TBLREQUEST (strRemarks) USING
> ('blablablabla...')" Set objRS = strConn.Execute(STRSQL)
??Why would you open a recordset on a query that does not return records??
If you're going to do this, then skip the recordset:
cnReq.Execute strSQL,,129
The 129 tells ADO not to create a recordset because the query you are
executing does not return records.
I cover the problems with using dynamic sql in at least one of the links I
provided in my earlier reply. Using dynamic sql to create your update/insert
statements will be more efficient than using a recordset, but less
efficient, and less secure, than using a saved parameter query.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: weird error, don"t know why
am 24.11.2004 17:45:24 von JohnDpatriot
Bob Barrows [MVP] wrote:
> JohnDpatriot wrote:
>
>>Bob Barrows [MVP] wrote:
>>
>>>Philmans wrote:
>>>
>>>
>>>>Hi all,
>>>>
>>>>What's wrong with the code below?
>>>>Everything is working fine except the Addnew and the Update lines?
>>>
>>>
>>>While AddNew and Update may be efficient in VB, they are very
>>>inefficient in ASP. You should be using saved parameter queries to
>>>do your inserts and updates. See:
>>>
>>>
>>>
>
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=eHYxOyvaDHA.4020%40tk2msftngp13.phx.gbl
>
>>>
>>>
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1& selm=ukS%246S%247CHA.2464%40TK2MSFTNGP11.phx.gbl
>
>>>
> http://www.google.com/groups?selm=eETTdnvFDHA.1660%40TK2MSFT NGP10.phx.gbl&oe=UTF-8&output=gplain
>
>>>
>>>>All names and paths are correct, when i just read the database
>>>>there's no problem, it occurs when i want to add/update something.
>>>
>>>
>>>What occurs??? We're not looking over your shoulder. You need to
>>>tell us what your symptoms are if we are to have any chance at all
>>>of diagnosing your problem.
>>>
>>>As a guess, I suspect you are experiencing permissions issues. Your
>>>IUSR account (Internet Guest Account) requires read/write
>>>permissions on the folder containing your database (not just the mdb
>>>file - the entire folder). See
>>>http://www.aspfaq.com/show.asp?id=2009
>>>http://www.aspfaq.com/show.asp?id=2062
>>>
>>>Bob Barrows
>>>
>>
>>Bob,
>>
>>Would it be equally innefficient to write the adds/updates as SQL and
>>execute them ?
>>
>>ie.
>>
>>STRSQL = "INSERT INTO TBLREQUEST (strRemarks) USING
>>('blablablabla...')" Set objRS = strConn.Execute(STRSQL)
>
>
> ??Why would you open a recordset on a query that does not return records??
> If you're going to do this, then skip the recordset:
>
> cnReq.Execute strSQL,,129
>
> The 129 tells ADO not to create a recordset because the query you are
> executing does not return records.
>
>
> I cover the problems with using dynamic sql in at least one of the links I
> provided in my earlier reply. Using dynamic sql to create your update/insert
> statements will be more efficient than using a recordset, but less
> efficient, and less secure, than using a saved parameter query.
>
> Bob Barrows
I am using an advantage server to connect to a foxpro database being
hosted on a novell 5.1 server. Unfortunately saved parameter queries
are not an option for me, but I like the idea of the ,,129. I will
implement it.
John,
Re: weird error, don"t know why
am 24.11.2004 19:39:35 von reb01501
JohnDpatriot wrote:
>
> I am using an advantage server to connect to a foxpro database being
> hosted on a novell 5.1 server. Unfortunately saved parameter queries
> are not an option for me,
Foxpro doesn't support stored procedures? Too bad.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: weird error, don"t know why
am 25.11.2004 09:03:11 von Philmans
Hi Bob,
i've did try your solutions and none of the above seems to be working out
ok.
I'm still getting some general 500 error code when the cnReq connection
tries to insert values into the table by passing params through a saved
query.
You talked about permissions but they're all fine. I have several other
Access-databases as well running and, strange thing, they all accept
the update and addnew and insert into commands, none of them is returning a
error.
I'm just tripping, it's driving me nuts!
<%
dim strConn
dim strSQL
dim strFirstName
dim strLastName
strFirstName = request.form("firstname")
strLastName = request.form("lastname")
Set cnReq = Server.CreateObject("ADODB.Connection")
strConn = "Provider=MICROSOFT.JET.OLEDB.4.0; " & "DATA SOURCE=" &
Server.MapPath("databases/requests.mdb") & ";"
cnReq.open strConn
cnReq.qryAddApp strFirstName,strLastName
%>
cao
"Bob Barrows [MVP]" schreef in bericht
news:eHSkzTl0EHA.1188@tk2msftngp13.phx.gbl...
> JohnDpatriot wrote:
> >
> > I am using an advantage server to connect to a foxpro database being
> > hosted on a novell 5.1 server. Unfortunately saved parameter queries
> > are not an option for me,
>
> Foxpro doesn't support stored procedures? Too bad.
>
> Bob Barrows
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Re: weird error, don"t know why
am 25.11.2004 13:48:27 von reb01501
Philmans wrote:
> Hi Bob,
>
> i've did try your solutions and none of the above seems to be working
> out ok.
>
> I'm still getting some general 500 error code when the cnReq
> connection tries to insert values into the table by passing params
> through a saved query.
If you are getting general 500 error messages, then you need to turn off
Friendly Error Messages in your browser so you can find out what actually is
happening.
http://www.aspfaq.com/show.asp?id=2109
>
> You talked about permissions but they're all fine. I have several
> other Access-databases as well running and, strange thing, they all
> accept
> the update and addnew and insert into commands, none of them is
> returning a error.
>
> I'm just tripping, it's driving me nuts!
In addition to the above, it's time for some basic debugging. I assume
you've tested your saved query in Access so you know it works when proper
parameter values are provided. That allows us to concentrate on your ASP
code.
>
> <%
> dim strConn
> dim strSQL
> dim strFirstName
> dim strLastName
>
> strFirstName = request.form("firstname")
> strLastName = request.form("lastname")
First of all, verify that this data has been properly passed:
Response.write "strFirstName contains """ & strFirstName & """
"
Response.write "strLastName contains """ & strLastName & """
"
>
> Set cnReq = Server.CreateObject("ADODB.Connection")
> strConn = "Provider=MICROSOFT.JET.OLEDB.4.0; " & "DATA SOURCE=" &
> Server.MapPath("databases/requests.mdb") & ";"
>
Now do some error-trapping:
On Error Resume Next
> cnReq.open strConn
If err <> 0 then
Response.Write "An error occurred when attempting to open cnReq:
"
Response.Write err.Number & ": " & err.Description
set cnReq = Nothing
Response.End
end if
>
> cnReq.qryAddApp strFirstName,strLastName
If err <> 0 then
Response.Write "An error occurred when attempting to add data:
"
Response.Write err.Number & ": " & err.Description
cnReq.close: set cnReq = Nothing
Response.End
end if
>
Don't forget to close and destroy your connection:
cnReq.close: set cnReq = Nothing
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"
Re: weird error, don"t know why
am 25.11.2004 21:23:43 von Philmans
I turned off Friendly Error Messages and now i have this error:
Microsoft JET Database Engine error '80040e4d'
Cannot start your application. The workgroup information file is missing or
opened exclusively by another user.
/processrequest.asp, line 9
code below:
<%
dim strConn
dim cnReq
strConn = "Provider=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" &
Server.MapPath("databases/apprequests.mdb") & ";"
Set cnReq = Server.CreateObject("ADODB.Connection")
cnReq.open strConn,,129 // -> THIS IS LINE 9 which is causing the error !
cnReq.AddNewRequest "John", "Doe" // -> AddNewRequest is a add query
which resides inside the database with two params
%>
I just have to overlook something but what?
I checked file, folder, internet security settings and all are ok.
The system.mdw resides in the same folder where the database is stored.
Now, i'm allready bald but if i still had some hair left they were all gone
by now!
Note that i've several other databases which resides in the same folder and
there i'm not having any errors at all!
"Bob Barrows [MVP]" schreef in bericht
news:%23pKxS0u0EHA.1932@TK2MSFTNGP09.phx.gbl...
> Philmans wrote:
> > Hi Bob,
> >
> > i've did try your solutions and none of the above seems to be working
> > out ok.
> >
> > I'm still getting some general 500 error code when the cnReq
> > connection tries to insert values into the table by passing params
> > through a saved query.
>
> If you are getting general 500 error messages, then you need to turn off
> Friendly Error Messages in your browser so you can find out what actually
is
> happening.
>
> http://www.aspfaq.com/show.asp?id=2109
>
> >
> > You talked about permissions but they're all fine. I have several
> > other Access-databases as well running and, strange thing, they all
> > accept
> > the update and addnew and insert into commands, none of them is
> > returning a error.
> >
> > I'm just tripping, it's driving me nuts!
>
> In addition to the above, it's time for some basic debugging. I assume
> you've tested your saved query in Access so you know it works when proper
> parameter values are provided. That allows us to concentrate on your ASP
> code.
>
> >
> > <%
> > dim strConn
> > dim strSQL
> > dim strFirstName
> > dim strLastName
> >
> > strFirstName = request.form("firstname")
> > strLastName = request.form("lastname")
>
> First of all, verify that this data has been properly passed:
>
> Response.write "strFirstName contains """ & strFirstName & """
"
> Response.write "strLastName contains """ & strLastName & """
"
>
> >
> > Set cnReq = Server.CreateObject("ADODB.Connection")
> > strConn = "Provider=MICROSOFT.JET.OLEDB.4.0; " & "DATA SOURCE=" &
> > Server.MapPath("databases/requests.mdb") & ";"
> >
>
> Now do some error-trapping:
>
> On Error Resume Next
>
> > cnReq.open strConn
>
> If err <> 0 then
> Response.Write "An error occurred when attempting to open cnReq:
"
> Response.Write err.Number & ": " & err.Description
> set cnReq = Nothing
> Response.End
> end if
>
> >
> > cnReq.qryAddApp strFirstName,strLastName
>
> If err <> 0 then
> Response.Write "An error occurred when attempting to add data:
"
> Response.Write err.Number & ": " & err.Description
> cnReq.close: set cnReq = Nothing
> Response.End
> end if
>
> >
>
> Don't forget to close and destroy your connection:
>
> cnReq.close: set cnReq = Nothing
>
>
> 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"
>
>
Re: weird error, don"t know why
am 25.11.2004 22:59:15 von reb01501
Philmans wrote:
> I turned off Friendly Error Messages and now i have this error:
>
>
> Microsoft JET Database Engine error '80040e4d'
>
> Cannot start your application. The workgroup information file is
> missing or opened exclusively by another user.
>
>
> cnReq.open strConn,,129 // -> THIS IS LINE 9 which is causing the
> error !
You don't use the 129 in your Connection open statement. It's meant to be
used when executing a query.
cnReq.Execute strSQL,,129
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"
Re: weird error, don"t know why
am 26.11.2004 06:56:08 von Philmans
Thanks Bob,
That just solved it.
I think i was staring to intense to this code that i just didn't see
anything wrong.
"Bob Barrows [MVP]" schreef in bericht
news:OUcZBoz0EHA.824@TK2MSFTNGP11.phx.gbl...
> Philmans wrote:
> > I turned off Friendly Error Messages and now i have this error:
> >
> >
> > Microsoft JET Database Engine error '80040e4d'
> >
> > Cannot start your application. The workgroup information file is
> > missing or opened exclusively by another user.
> >
> >
> > cnReq.open strConn,,129 // -> THIS IS LINE 9 which is causing the
> > error !
>
> You don't use the 129 in your Connection open statement. It's meant to be
> used when executing a query.
>
> cnReq.Execute strSQL,,129
>
> 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"
>
>