Turn on thread page Beta
    • Thread Starter
    Offline

    0
    ReputationRep:
    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.
    • Thread Starter
    Offline

    0
    ReputationRep:
    P.S The language I am using is VBSCRIPT
    Offline

    0
    ReputationRep:
    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
    • Thread Starter
    Offline

    0
    ReputationRep:
    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.
    Offline

    0
    ReputationRep:
    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.
    • Thread Starter
    Offline

    0
    ReputationRep:
    thanks. I will send an email to my course tutor to see if he can figure it out.

    Thanks for you help though.
    Offline

    0
    ReputationRep:
    (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.
 
 
 
Poll
How are you feeling in the run-up to Results Day 2018?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.