[asp sql access] Query fout

Pagina: 1
Acties:

  • Driek
  • Registratie: Maart 2002
  • Laatst online: 22:12
hallo

ik heb in access een database met meerdere tabbellen
ik heb 1 tabel die die verschillende tabbellen koppelt.
Hier staat dus van al die verschillende tabbellen elke keer een id genoemd.
nu wil ik door middel van een query niet al die id's, maar de namen achter die id's weergeven.
in access heb ik deze sql bedacht:

SELECT org_product.product, unity.unity, feature.feature, price
FROM Price, org_product, unity, feature
WHERE price.id_product=org_product.id_product
AND price.id_unity=unity.id_unity
AND price.id_feature=feature.id_feature
AND price.id_product=80;

in access werkt hij
in asp heb ik um zo gemaakt:
oRs1.open "SELECT org_product.product, unity.unity, feature.feature, price FROM Price, org_product, unity, feature WHERE " &_
"price.id_product= " & org_product.id_product &_
"AND price.id_unity = " & unity.id_unity &_
"AND price.id_feature= " & feature.id_feature &_
"AND price.id_product= " & id,oConn, adOpenStatic, adLockReadonly' , , ,adOpenDynamic


alleen nu geeft hij dus een foutmelding:
Runtime-fout Microsoft VBScript fout '800a01a8'

Object vereist: 'org_product'

/admin_price.asp, regel 247


waar gaat het fout, de foutmelding gaat iver de regel waar Select in staat.

Tijd van werken, tijd van rusten


  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 21:24

Basszje

Reisvaap!]

Kijk eens op je aanhalingstekens etc wel goed staan :?
Dit is nl een ASP fout wat er op duidt dat de code niet door de dbase maar door ASP uitgevoerd wordt.

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.


  • Driek
  • Registratie: Maart 2002
  • Laatst online: 22:12
het lijkt net of hij de punt in "org_product.id_product" niet snapt.
zou dit kunnen?

Tijd van werken, tijd van rusten


  • PhoneTech
  • Registratie: Mei 2000
  • Laatst online: 09-09 17:22
Wat altijd enorm help bij het problemenschieten is het maken van een response.write van de sql string...

Niet uitvoeren, maar eerst effe een response.write van de sqlstring...

Dus
code:
1
2
3
4
5
6
7
8
9
strSQL = "SELECT org_product.product, unity.unity, feature.feature, price FROM Price, org_product, unity, feature WHERE " &_
"price.id_product= " & org_product.id_product &_
"AND price.id_unity = " & unity.id_unity &_
"AND price.id_feature= " & feature.id_feature &_
"AND price.id_product= " & id

response.write strSQL

'Set ObjRS = ObjConn.Execute(strSQL)

Probeer anders ook effe de SQL string in access uit...Die geeft meestal mooiere foutmeldingen...

En het ziet er trouwens naar uit dat je een spelfoutje gemaakt hebt...

Verwijderd

Hij kan het object org_product niet vinden (net als bijvoorbeeld het response object).

Dat komt omdat de string na price.id_product = " afgesloten worden en ASP gaat vrolijk verder met verwerken van de code. Hij komt dan org_product.id_product tegen en dat snapt ie niet...
code:
1
2
3
4
5
"SELECT org_product.product, unity.unity, feature.feature, price FROM Price, org_product, unity, feature WHERE " &_
"price.id_product= " & org_product.id_product &_
"AND price.id_unity = " & unity.id_unity &_
"AND price.id_feature= " & feature.id_feature &_
"AND price.id_product= " & id

of
code:
1
2
3
4
5
6
"SELECT org_product.product, unity.unity, feature.feature, price " &_
"FROM Price, org_product, unity, feature " &_
"WHERE price.id_product= " & org_product.id_product "&_
"AND price.id_unity = unity.id_unity "&_
"AND price.id_feature = feature.id_feature " &_
"AND price.id_product = "& id

Zoek de verschillen en je snapt je vout 8-)

  • Driek
  • Registratie: Maart 2002
  • Laatst online: 22:12
ik wordt helemaal :? van die gekke aanhalingstekens

Tijd van werken, tijd van rusten


  • Driek
  • Registratie: Maart 2002
  • Laatst online: 22:12
Compilatiefout Microsoft VBScript fout '800a0409'

Tekenreeksconstante is niet afgesloten

/admin_price.asp, regel 255

"AND price.id_feature= feature.id_feature &_
--------------------------------------------^
nu krijg ik die fout weer :? :?

Tijd van werken, tijd van rusten


  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 09-09 20:58

Janoz

Moderator Devschuur®

!litemod

nou, die fout zie ik met mijn ogen bijna dicht nog :).. tel je "'s eens in die regel :)

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


  • Driek
  • Registratie: Maart 2002
  • Laatst online: 22:12
Op woensdag 03 april 2002 15:30 schreef Janoz het volgende:
nou, die fout zie ik met mijn ogen bijna dicht nog :).. tel je "'s eens in die regel :)
ik nu ook
|:(

Tijd van werken, tijd van rusten


Verwijderd

He you all,
Volgens mij haal jij asp objecten en Acces tabellen door elkaar heen. is die org_project een tabel of een asp-object?? Als het een tabel is dan moet het ongeveer zo zijn:

strSQL = "SELECT org_product.product, unity.unity, feature.feature, price FROM Price, org_product, unity, feature WHERE " &_
"price.id_product= org_product.id_product" &_
" AND price.id_unity = unity.id_unity" &_
" AND price.id_feature= feature.id_feature" &_
" AND price.id_product= id"

Als het wel een ASP-object is dan moet je waarschijnlijk je object nog definieren o.i.d.
:7

  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 21:24

Basszje

Reisvaap!]

Op donderdag 04 april 2002 12:08 schreef ASPTweak het volgende:
He you all,
Volgens mij haal jij asp objecten en Acces tabellen door elkaar heen. is die org_project een tabel of een asp-object?? Als het een tabel is dan moet het ongeveer zo zijn:

strSQL = "SELECT org_product.product, unity.unity, feature.feature, price FROM Price, org_product, unity, feature WHERE " &_
"price.id_product= org_product.id_product" &_
" AND price.id_unity = unity.id_unity" &_
" AND price.id_feature= feature.id_feature" &_
" AND price.id_product= id"

Als het wel een ASP-object is dan moet je waarschijnlijk je object nog definieren o.i.d.
:7
Volgens mij haalde hij eerder wat aanhalingstekens door elkaar :)

(wat irritant is, maar als je de 'type' foutmelding kent weet je wat er meestal mis is :) ) .

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.

Pagina: 1