Help - A last resort.

Discussion in 'General Chat' started by amazingtrade, Dec 20, 2003.

  1. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    0
    Location:
    Manchester
    After days of trying to get this simple code to work it still is not working.

    I need to develop an online shopping site using access and ASP.

    I've got this page working fine. The records are displayed from a database.

    http://www.robertson-i.co.uk/shop/cd.asp

    That page works fine it clicking on a submit button then submits a query string ID to the order.asp such as below

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

    This again works fine, however I need to say if datid=3 then show select record with the ID of 3.

    I've done this using an SQL statement but there is aproblem with this line of code:

    ObjRS.Open "SELECT FROM cd.ID, cd.product, cd.description, cd.price FROM cd WHERE (((cd.ID)=""" & prodid & """))" , objConn, ,adLockoptimistic , adCmdTable


    I just can't seem to work out what it is. It is comming up with this error message

    ADODB.Recordset error '800a0bb9'

    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

    /shop/order.asp, line 27


    Thanks if anybody know what it is causing this error. I have a feeling its somthing simple.
     
    amazingtrade, Dec 20, 2003
    #1
  2. amazingtrade

    penance Arrogant Cock

    Joined:
    Jun 30, 2003
    Messages:
    6,004
    Likes Received:
    2
    Location:
    Bristol - armpit of the west.
    penance, Dec 20, 2003
    #2
  3. amazingtrade

    Paul Ranson

    Joined:
    Sep 4, 2003
    Messages:
    1,602
    Likes Received:
    0
    Location:
    An octopus's garden.
    This looks bogus. Too many 'FROM's, too many '"'s etc.

    Also at a first glance 'adCmdTable' is inconsistent with expecting to execute a SQL query. Perhaps 'adCmdText' or even 'adCmdUnspecified'.

    (I've just had a browse of msdn.microsoft.com, reading the documentation is always a good last resort...)

    Paul
     
    Paul Ranson, Dec 20, 2003
    #3
  4. amazingtrade

    sideshowbob Trisha

    Joined:
    Jun 20, 2003
    Messages:
    3,092
    Likes Received:
    0
    Location:
    London
    I don't do ASP, but the SQL should be something like:

    (I'm assuming prodid is an integer rather than a string, if it's a string it shouldn't be)

    -- Ian
     
    sideshowbob, Dec 20, 2003
    #4
  5. amazingtrade

    Paul Ranson

    Joined:
    Sep 4, 2003
    Messages:
    1,602
    Likes Received:
    0
    Location:
    An octopus's garden.
    I think it's nothing to do with ASP, rather ADO and VB(script).

    Paul
     
    Paul Ranson, Dec 20, 2003
    #5
  6. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    0
    Location:
    Manchester
    It is just a string. The ID could be anything it dosn't have to be a number. Originaly I had it working by having it as an integer and using the objrs.move prodid this worked fine until I added stuff to the database via the web and it sticks the record at the top messing up the entire system.

    That is why I am doing it by the SQL method. I do have books on ASP but the one I have is crap, I might buy another one. I will have a look at that other forum and try out them suggestions first.

    We have not been taught any SQL we are covering it next semester however were told if he could do create an online shopping basket we would achieve very hard marks because of the level of research it requiresd. (since we have not been tauhht it yet)

    Its a good job I strarted this assignment early:)

    Thanks anyway people.
     
    amazingtrade, Dec 20, 2003
    #6
  7. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    0
    Location:
    Manchester
    Yep the technicaly is ASP but the language is VBSCRIPT.
     
    amazingtrade, Dec 20, 2003
    #7
  8. amazingtrade

    sideshowbob Trisha

    Joined:
    Jun 20, 2003
    Messages:
    3,092
    Likes Received:
    0
    Location:
    London
    Primary key fields should always be numbers, unless there's a very good design reason for them not being so. It probably doesn't matter much in this case, but table joins, indices, and the like, are much more efficient using integers than strings, especially if you're designing a table that's likely to contain a large number of records. It's good to get into good habits even when it doesn't really matter.

    -- Ian
     
    sideshowbob, Dec 20, 2003
    #8
  9. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    0
    Location:
    Manchester
    Where did you all learn this stuff? I would have though it would be pretty easy but I am finding it so hard. I find C++ much easier than this.
     
    amazingtrade, Dec 20, 2003
    #9
  10. amazingtrade

    Paul Ranson

    Joined:
    Sep 4, 2003
    Messages:
    1,602
    Likes Received:
    0
    Location:
    An octopus's garden.
    According to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdaenumac_7.asp adCmdTable
    'Evaluates CommandText as a table name whose columns are all returned by an internally generated SQL query.' Your CommandText is a SQL query not a table name. So that would be an explanation for the reported error.

    FWIW I think that any more than one record returned from this query would be an error, and assuming you're using the prime key impossible, so using a Record object rather than a RecordSet would be more appropriate and probably simpler.

    Paul
     
    Paul Ranson, Dec 20, 2003
    #10
  11. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    0
    Location:
    Manchester
    I'm going mad now I've been reading up on SQL and it should work. I've tried this simple statement to get all the records.

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

    Nothing seems to work. I've spent hours trying it and its just getting silly now as what I am trying to is so simple.
     
    amazingtrade, Dec 20, 2003
    #11
  12. amazingtrade

    Paul Ranson

    Joined:
    Sep 4, 2003
    Messages:
    1,602
    Likes Received:
    0
    Location:
    An octopus's garden.
    But now your error message has changed.

    In the order page you only want the one record, so why are you asking for the entire table?

    Email me your ASPs and mdb if you want.

    Paul
     
    Paul Ranson, Dec 20, 2003
    #12
  13. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    0
    Location:
    Manchester
    yeah the error message keeps changing because I've basicaly spent the entire day trying to fix it so changing the code.

    I'm going out now but if you could have a quick look at the code tomorrow I shall be very greatful. I am sure it can only be somthing very simple as the code seems to be text book standard.

    I will send the ASP code tomorrow and the access database file.

    Thanks.
     
    amazingtrade, Dec 20, 2003
    #13
  14. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    0
    Location:
    Manchester
    Finally fixed it.

    I sat down this morning and read my ASP book.

    This line works fine now

    objRS.open "SELECT * FROM CD WHERE ID = '" & prodid & "'", objConn, , , adCmdText
     
    amazingtrade, Dec 21, 2003
    #14
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
Loading...