网格视图绑定中的异常“没有为一个或多个所需参数给出值". [英] Exception in Grid view Binding "No value given for one or more required parameters."

查看:78
本文介绍了网格视图绑定中的异常“没有为一个或多个所需参数给出值".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.
我通过SQL数据源绑定网格视图,对此我没有此代码

Hello All..
i am binding grid view by sql data Source for which i have don this code

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" AllowPaging="True" 

        AllowSorting="True" onselectedindexchanged="lbtn_buyNow_Click"  

        CssClass="registration_form" BorderColor="#E3E3E1" PageSize="20">
         <alternatingrowstyle />
        <columns>
            <asp:BoundField DataField="StartDate" HeaderText="Start Date" />
            <asp:BoundField DataField="Duration" HeaderText="Duration" />
            <asp:BoundField DataField="Title" HeaderText="Title" />
            <asp:BoundField DataField="Vanue" HeaderText="Vanue" />
            <asp:BoundField DataField="City" HeaderText="City" />
            <asp:BoundField DataField="Type" HeaderText="Type" />
            <asp:BoundField DataField="ID" HeaderText="ID" Visible="false"/>
            <asp:TemplateField HeaderText="Details">
                <itemtemplate>
                    <asp:LinkButton ID="lbtndetails" runat="server" oncommand="lbtndetails_Command" CommandArgument='<%# Bind("ID") %>' CausesValidation="False">View Details
                </itemtemplate>
            
            <asp:TemplateField HeaderText="Buy Now">
                <itemtemplate>
                    <asp:LinkButton ID="lbtn_buyNow" runat="server" onclick="lbtn_buyNow_Click" CausesValidation="False">Buy Now
                </itemtemplate>
            
        </columns>   
    
   <asp:AccessDataSource ID="AccessDataSource1" runat="server" 

        DataFile="~/App_Data/Users.mdb" 

        

    SelectCommand="SELECT [ID], [StartDate], [Duration], [Title],[Vanue],[City],[Type] FROM [trainingcalendar]">


但是有一个例外,因为...


but there is a exception as...

No value given for one or more required parameters.


请帮助我做错什么...


plz help what i doing wrong...

推荐答案

亲爱的乌玛山卡,

该错误是由于多种原因造成的:-

1).获取实际上不存在的列.
2).列名称可能与您要获取的名称不同
3).该参数的值未传递.

请参阅此链接以获取更多信息:-

http://www.daniweb.com/web-development/aspnet/threads/275039 [ ^ ]

请不要忘记将此标记为您的答案.

谢谢
Dear Umashankar,

This error is due to many reasons:-

1). fetching a column which doesn''t really exist.
2). Column name may be different than what you are fetching
3). The value for the parameter is not being passed.

Refer to this link for more information:-

http://www.daniweb.com/web-development/aspnet/threads/275039[^]

Please don''t forget to mark thsi as your answer.

Thanks


这篇关于网格视图绑定中的异常“没有为一个或多个所需参数给出值".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆