This discussion is closed.
AT82
Badges: 0
Rep:
?
#1
Report Thread starter 16 years ago
#1
I am getting desperate now I've been trying to get this working since 10:30 this morning.

Why does this line of code not work?

objRS.Open "SELECT * FROM cd" , objConn, ,adLockoptimistic, adCmdUnspecified

It keeps coming up with this

http://www.robertson-i.co.uk/shop/order.asp?dataid=6


All I want to at this point is get all records to display from the CD table.

Once I get that working I can try the more advanced stuff. The connection method has to be SQL though.
0
AT82
Badges: 0
Rep:
?
#2
Report Thread starter 16 years ago
#2
P.S The language I am using is VBSCRIPT
0
loftx
Badges: 0
Rep:
?
#3
Report 16 years ago
#3
You could try using this code instead


Code:
Dim objRS  
Dim objConn
Dim strQ

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\shop\database.mdb")   )
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objRS.ActiveConnection = objConn

strQ = "SELECT cd.ID, cd.product, cd.description, cd.price FROM cd WHERE (((cd.ID)=""" & prodid  & """))"
objRS.open strQ

if objRS.eof then 
	' error
else
 response.write "you selected product" & objRS("ID")
end if


objRS.close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
0
AT82
Badges: 0
Rep:
?
#4
Report Thread starter 16 years ago
#4
It says this now:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/shop/order.asp, line 28


I just can't work out what the problem is. I don't think ASP likes me. I can do C++ quite easily.
0
loftx
Badges: 0
Rep:
?
#5
Report 16 years ago
#5
Hmm dunno why its doing that - maybe if you just change some bits in existing examples you can work out what is wrong. The examples from the book i use are here - i think they have a shopping cart.
0
AT82
Badges: 0
Rep:
?
#6
Report Thread starter 16 years ago
#6
thanks. I will send an email to my course tutor to see if he can figure it out.

Thanks for you help though.
0
loftx
Badges: 0
Rep:
?
#7
Report 16 years ago
#7
(Original post by amazingtrade)
thanks. I will send an email to my course tutor to see if he can figure it out.

Thanks for you help though.
If i get time I will try and download all your files and set it up for myself - I'm sure it a really obvious problem but just can't seem to work it out.
0
X
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

How do you feel about your grades? Are they...

What I expected (155)
24.72%
Better than expected (131)
20.89%
Worse than expected (341)
54.39%

Watched Threads

View All