 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 11th, 2006, 09:26 AM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
... it is not the case with the other Win XP in the house...
|
|

March 11th, 2006, 09:34 AM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
...bye the way, can you take a look at this code?
It is all out of the book (almost), but does it work...no!
<% option explicit
dim kobling
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>registrering_1_mann_sjekk</title>
</head>
<body>
<%
dim objCommand,objrs
set objCommand = server.createobject("ADODB.Command")
objCommand.ActiveConnection = kobling
objCommand.CommandText = "SELECT ProduktHoyde, ProduktHaar, ProduktOye, ProduktVekt, ProduktNavn FROM Produkt " & "WHERE ProduktNavn LIKE 'Session("ProduktNavn")'";"
objCommand.CommandType = adCmdText
Set objRs = objCommand.Execute
Set objCommand = Nothing
If objRs.EOF Then
Response.redirect "start.asp"
Else
objrs("ProduktHoyde").value = Request.form("hoyde")
objrs("ProduktHaar").value = Request.form("haar")
objrs("ProduktOye").value = Request.form("oye")
objrs("ProduktVekt").value = Request.form("vekt")
objrs.update
End if
objrs.Close
Set objrs = nothing
response.redirect "registrering_2_mann.asp"
%>
</body>
</html>
Teknisk informasjon (for kundestøttepersonell)
Feiltype:
(0x80004005)
Uspesifisert feil.
/innsjekk/registrering_1_mann_sjekk.asp, linje 27
Lesertype:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Side:
POST 70 bytes til /innsjekk/registrering_1_mann_sjekk.asp
POST-data:
hoyde=150&haar=lys_blond
|
|

March 11th, 2006, 09:54 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Take a look at this FAQ:
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=263
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

March 11th, 2006, 12:43 PM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
...the permissions are proper set (except from the c:-thing), but it is still this attemt on an sql-update-query...hmmmm.
I'll try to follow the lines on page 580 (ASP 3.0), and have a new try...
Or, can't you just give me the right script-lines missing?  ...
|
|

March 11th, 2006, 01:10 PM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
...can I use sessions and var as values in a sql UPDATE-query..?
Med vennlig hilsen
grstad
(som spør mer enn ti vise kan svare)
|
|

March 12th, 2006, 05:51 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
80004005 errors are almost always related to security. Are you sure you set up the permissions for the right account and the right folder(not only the database file itself)? What account did you set the settings for?
You can use Sessions in a SQL statement. However, you need to concatenate its value. Right now, you send the word Session to the WHERE clause. Change it to something like:
objCommand.CommandText = "SELECT ProduktHoyde, ProduktHaar, ProduktOye, ProduktVekt, ProduktNavn FROM Produkt WHERE ProduktNavn LIKE '%" & Session("ProduktNavn") & "%';"
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

March 13th, 2006, 07:29 AM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
...ok, but what are the %'s for...?
|
|

March 13th, 2006, 02:00 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Those are wild card characters.
You used LIKE in your query, so I assumed you're trying to search for patterns, not for exact words in the column. If you want to search for the exact column's value, drop the % characters, and use = 'SomeValue' instead of LIKE 'SomeValue'
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

March 13th, 2006, 06:42 PM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
... Ok. I am now trying a new "formula";
dim sesam,objRs
Set objRs = Server.CreateObject("ADODB.Recordset")
sesam = "SELECT * FROM Produkt WHERE ProduktNavn=" & Session("ProduktNavn") & ";"
objRs.Open sesam, kobling, adOpenKeyset, adLockPessimistic, adCmdText
If Not objRs.EOF Then
objRs.MoveFirst
objRs.Fields("ProduktHoyde") = Request.form("hoyde")
objRs.Fields("ProduktHaar") = Request.form("haar")
objRs.Fields("ProduktOye") = Request.form("oye")
objRs.Fields("ProduktVekt") = Request.form("vekt")
objRs.Update
End If
objRs.Close
Set objRs = Nothing
...and this involves a new provider. What will be the right path for my databasefile (local)? The providerstring is;
kobling="Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.Mappath("virtuell path") & ";"
I know I am jumping from one problem to the next. But it seems one error is followed by the next and the next and...
Med vennlig hilsen
grstad
|
|

March 14th, 2006, 01:57 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Take a look here:
http://www.connectionstrings.com/
Look under Access for a proper connection string.
Basically, you can embed a hard coded path in the connection string, or use Server.MapPath to translate a virtual path in a physical one.
So, for example, if you have a folder called Databases in the root of your site, then:
Server.MapPath("/Databases") will return something like
c:\inetpub\wwwroot\Databases
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |