我的错误: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找不到非通用方法
发布评论