locked
"No value given for one or more required parameters." RRS feed

  • Question

  • User-2111876952 posted

    Basically I have created a Access Database which I'd like to make viewable on the internet. Obviously need to start small and so my aim is to simply try and view records from a particular table...I'v gone through a very good tutorial on the net and just changed the names of Tables and whatnot to reflect my own:

    Database is called = 'CatalogXP_Backup.mdb'
    Table is called = 'Make'
    Fields within Table are called = 'MakeID' & 'Make'

    So I have created a .asp file (using the same name as the Database) to try and view the data within the 'Make' table. Here is the code:
    <html>
    <head>
    <title>My First ASP Page</title>
    </head>
    <body bgcolor="white" text="black">

    <%
    'Dimension variables
    Dim adoCon 'Holds the Database Connection Object
    Dim rsCatalogXP_Backup 'Holds the recordset for the records in the database
    Dim strSQL 'Holds the SQL query to query the database

    'Create an ADO connection object
    Set adoCon = Server.CreateObject("ADODB.Connection")

    'Set an active connection to the Connection object using a DSN-less connection
    adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("CatalogXP_Backup.mdb")

    'Create an ADO recordset object - Holds the records
    Set rsCatalogXP_Backup = Server.CreateObject("ADODB.Recordset")

    'Initialise the strSQL variable with an SQL statement to query the database
    strSQL = "SELECT Make.Name, Make.Make FROM Make;"

    'Open the recordset with the SQL query
    rsCatalogXP_Backup.Open strSQL, adoCon


    'Loop through the recordset
    Do While not rsCatalogXP_Backup.EOF

    'Write the HTML to display the current record in the recordset
    Response.Write ("<br>")
    Response.Write (rsCatalogXP_Backup("MakeID"))
    Response.Write ("<br>")
    Response.Write (rsCatalogXP_Backup("Make"))
    Response.Write ("<br>")

    'Move to the next record in the recordset
    rsCatalogXP_Backup.MoveNext
    Loop

    'Reset server objects
    rsCatalogXP_Backup.Close
    Set rsCatalogXP_Backup = Nothing
    Set adoCon = Nothing
    %>

    </body>
    </html>


    When I try and run the .asp file, i get an error message on line 26 (the line I have put in bold) which says

    "No value given for one or more required parameters."

    Can anyone shed any light as to why this might be occuring? As far as I can see I havent mis-spelled anything and the Database has been declared too.

    Wednesday, August 20, 2008 6:05 PM

All replies

  • User-1853252149 posted

    I suspect you may not have given us the correct details, since you say:

    Steve1977

    Fields within Table are called = 'MakeID' & 'Make'

    But your SQL Query is:

    Steve1977

    strSQL = "SELECT Make.Name, Make.Make FROM Make;"

    If those are really the only fields in your database, and that really is your query, the response would be expected -- you queried the wrong field name.

    Jeff

    Thursday, August 21, 2008 11:16 AM
  • User-2111876952 posted

    Thanks for your reply (and I'll check out that link too! :) )

     

    Maybe I'm confused in the information I have looked up, but I thought...

     

     strSQL = "SELECT <name_of_Table>.Name, <name_of_table>.<name_of_field> FROM <name_of_table>;"

     

    In which case I can see no problems with it or am I missing the obvious?

     

    This is the tutorial I am using: http://www.webwizguide.com/kb/asp_tutorials/connecting_to_a_database.asp

    Thursday, August 21, 2008 2:38 PM