错误ObjectDataSource找不到非通用方法 [英] Error ObjectDataSource could not find a non-generic method

查看:57
本文介绍了错误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找不到非通用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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