Click here to Skip to main content
15,917,652 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<div>
        <%--<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT [ProductID], [Name], [Description], [Price], [ImageUrl] FROM [Products] WHERE ([ProductID] = @ProductID)">
            <SelectParameters>
                <asp:QueryStringParameter Name="ProductID" QueryStringField="ProductID" Type="Decimal" />
            </SelectParameters>
        </asp:SqlDataSource>--%>


I'M TRYING TO  CONVERT  SQL DATABASE IN ACCESS  .. BUT IT IS GIVING ERROR " No value given for one or more required parameters ". ..



        <asp:AccessDataSource ID="AccessDataSource1" runat="server"
            DataFile="~/App_Data/DatabasePCG03.mdb"
        SelectCommand="SELECT [ProductID], [Name], [Description], [Price], [ImageUrl] FROM [Products] WHERE ([ProductID] = @ProductID)">
            <SelectParameters>
                <asp:QueryStringParameter Name="ProductID" QueryStringField="ProductID" Type="Decimal" />
            </SelectParameters>
        </asp:AccessDataSource>


    </div>
Posted
Comments
Bernhard Hiller 3-Apr-13 4:35am    
What about QueryStringParameter Name="@ProductID" ?
ZurdoDev 3-Apr-13 8:28am    
The error tells you the issue. You are not passing in a value for @ProductID.
Kschuler 9-Apr-13 17:16pm    
The error may not really be helpful. I get that error sometimes when I spell a field name wrong or if I leave a coma after the last field that I'm selecting. It really just means there is a problem somewhere. Perhaps you named a column in the actual database differently? Spelled soemthing wrong or named your file "Product" instead of "Products"? Double check that. And also make sure you're passing the parm value. Also syntax could be different between SQL and ACCESS. Maybe you don't need the @ symbol? Or maybe you also need it in the QueryStringParameter's Name or QueryStringField?

Please, try this:
SQL
SELECT [ProductID], [Name], [Description], [Price], [ImageUrl] FROM [Products] WHERE ([ProductID] = ?

or
SQL
PARAMETERS prodId INT;
SELECT [ProductID], [Name], [Description], [Price], [ImageUrl] FROM [Products] WHERE ([ProductID] = prodId


Please,have a look here: Parameter Queries in ASP.NET with MS Access[^]
http://www.evagoras.com/2011/02/08/calling ms access parameterized queries from asp/[^]
PARAMETERS Declaration (Microsoft Access SQL)[^]
 
Share this answer
 
i think your database field name and select command field is different please check it again ok
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900