错误ObjectDataSource找不到非通用方法

编程入门 行业动态 更新时间:2024-10-10 03:22:52
本文介绍了错误ObjectDataSource找不到非通用方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的错误:ObjectDataSource'dsGenre'找不到没有参数的非通用方法'GetGenre'.

My error: ObjectDataSource 'dsGenre' could not find a non-generic method 'GetGenre' that has no parameters.

我的代码:

<asp:DropDownList runat="server" ID="genreList" style="float:left;" DataSourceID="dsGenre" DataTextField="Author_Name" DataValueField="title_id" /> <asp:ObjectDataSource runat="server" ID="dsGenre" SelectMethod="GetGenre" TypeName="libros" /> <asp:SqlDataSource runat="server" ID="sqlGenres" ConnectionString="<%$ ConnectionStrings:library %>" ProviderName="<%$ ConnectionStrings:library.ProviderName %>" SelectCommand="get_allGenres" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:QueryStringParameter Name="genre_id" Type="Int32" QueryStringField="id" /> </SelectParameters> </asp:SqlDataSource>

为什么会出现错误以及如何纠正?

Why the error and how do I correct it?

推荐答案

您需要找到 libros 类,并检查其中是否存在GetGenre方法.就我们所知,此"libros"可能无法在此处访问.如果找不到GetGenre方法,请尝试在libros类中创建它.您可能需要做更多的编码才能获取回拉的数据,但至少它可以摆脱当前的错误并使您更接近目标.在此处有关ObjectDataSource的详细信息.

You'll need to find the libros class and check if a GetGenre method exists anywhere inside of it. For all we know, it's possible that this "libros" isn't accessible here. If you can't find a GetGenre method, try creating it inside the libros class. You'll probably have some more coding to do to get data to pull back but at least it might get rid of your current error and getting you closer to your goal. There's more information about ObjectDataSource here.

此外,可能还需要输入完全限定的类名.如果看不到更多代码,很难说.

Also, it could be that you need to put the fully qualified class name in. It's hard to say without seeing more of the code.

更多推荐

错误ObjectDataSource找不到非通用方法

本文发布于:2023-11-09 03:58:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571337.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   错误   方法   ObjectDataSource

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!