Error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'FillMenusByLocation

D

Dotnet Gruven

I've posted this in the adonet group, however it was suggested I might have
better luck here....
=============================================================
I'm trying to use a typed dataset and ObjectDataSource binding to a SQLX db
using a foreign key to filter the returned result set to display in a
GridView.

The error message in the subject line is generated when I try to bind the
following GridView to the ObjectSource that follows and the code that
follows that which is from an ASP.NET form PageLoad:
------------------------------- mypage.ascx ---------------------------
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="Delete" InsertMethod="Insert"
SelectMethod="FillMenusByLocation"

TypeName="RestaurantsTableAdapters.MenusTableAdapter"
UpdateMethod="Update">

<DeleteParameters>

<asp:parameter Name="Original_MenuId" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:parameter Name="LocationId" Type="Int32" />

<asp:parameter Name="MenuName" Type="String" />

<asp:parameter Name="IsAvailable" Type="Boolean" />

<asp:parameter Name="DisplayOrder" Type="Int32" />

<asp:parameter Name="Original_MenuId" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:parameter Name="LocationId" Type="Int32" />

<asp:parameter Name="MenuName" Type="String" />

<asp:parameter Name="IsAvailable" Type="Boolean" />

<asp:parameter Name="DisplayOrder" Type="Int32" />

</InsertParameters>

</asp:ObjectDataSource>

<asp:GridView ID="MenusGridView" Runat="server"
DataSourceID="ObjectDataSource1" DataKeyNames="LocationId" ShowHeader=True
AutoGenerateColumns="False"
CellPadding="4" ForeColor="#333333" GridLines="Both" >

<Columns>

<asp:BoundField ReadOnly="True" HeaderText="MenuId" DataField="MenuId"
SortExpression="MenuId" Visible=True />

<asp:BoundField ReadOnly="True" HeaderText="LocationId"
DataField="LocationId" SortExpression="LocationId" Visible=True />

<asp:BoundField HeaderText="Name" DataField="MenuName"
SortExpression="MenuName" />

<asp:CheckBoxField HeaderText="Available?" DataField="IsAvailable"
SortExpression="IsAvailable" ItemStyle-HorizontalAlign="Center" />

<asp:BoundField HeaderText="DisplayOrder" DataField="DisplayOrder"
SortExpression="DisplayOrder" />

</Columns>




</asp:GridView>

--------- From Page_Load !IsPostBack

ObjectDataSource1.SelectParameters.Add("@parameter1", TypeCode.Int32,
locationId.ToString());

----------
Here is the XSD for the related TableAdapter


<TableAdapter BaseClass="System.ComponentModel.Component"
DataAccessorName="MenusTableAdapter" Modifier="AutoLayout, AnsiClass, Class,
Public" Name="Menus" WebServiceAttribute="False">

<MainSource>

<DbSource ConnectionRef="ASPNETDBConnectionString (Web.config)"
DbObjectName="dbo.Menus" DbObjectType="Table" EnableWebMethods="False"
FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both"
GeneratePagingMethods="False" GenerateShortCommands="True"
GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object,
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
UseOptimisticConcurrency="False">

<DeleteCommand>

<DbCommand CommandType="Text" ModifiedByUser="False">

<CommandText>DELETE FROM [dbo].[Menus] WHERE (([MenuId] =
@Original_MenuId))</CommandText>

<Parameters>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="Int32" Direction="Input" ParameterName="@Original_MenuId"
Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MenuId"
SourceColumnNullMapping="False" SourceVersion="Original">

</Parameter>

</Parameters>

</DbCommand>

</DeleteCommand>

<InsertCommand>

<DbCommand CommandType="Text" ModifiedByUser="False">

<CommandText>INSERT INTO [dbo].[Menus] ([LocationId], [MenuName],
[IsAvailable], [DisplayOrder]) VALUES (@LocationId, @MenuName, @IsAvailable,
@DisplayOrder)</CommandText>

<Parameters>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="Int32" Direction="Input" ParameterName="@LocationId" Precision="0"
ProviderType="Int" Scale="0" Size="0" SourceColumn="LocationId"
SourceColumnNullMapping="False" SourceVersion="Current">

</Parameter>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="String" Direction="Input" ParameterName="@MenuName" Precision="0"
ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="MenuName"
SourceColumnNullMapping="False" SourceVersion="Current">

</Parameter>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="Boolean" Direction="Input" ParameterName="@IsAvailable"
Precision="0" ProviderType="Bit" Scale="0" Size="0"
SourceColumn="IsAvailable" SourceColumnNullMapping="False"
SourceVersion="Current">

</Parameter>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="Int32" Direction="Input" ParameterName="@DisplayOrder" Precision="0"
ProviderType="Int" Scale="0" Size="0" SourceColumn="DisplayOrder"
SourceColumnNullMapping="False" SourceVersion="Current">

</Parameter>

</Parameters>

</DbCommand>

</InsertCommand>

<SelectCommand>

<DbCommand CommandType="Text" ModifiedByUser="True">

<CommandText>SELECT MenuId, LocationId, MenuName, IsAvailable, DisplayOrder
FROM Menus</CommandText>

<Parameters>

</Parameters>

</DbCommand>

</SelectCommand>

<UpdateCommand>

<DbCommand CommandType="Text" ModifiedByUser="False">

<CommandText>UPDATE [dbo].[Menus] SET [LocationId] = @LocationId, [MenuName]
= @MenuName, [IsAvailable] = @IsAvailable, [DisplayOrder] = @DisplayOrder
WHERE (([MenuId] = @Original_MenuId))</CommandText>

<Parameters>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="Int32" Direction="Input" ParameterName="@LocationId" Precision="0"
ProviderType="Int" Scale="0" Size="0" SourceColumn="LocationId"
SourceColumnNullMapping="False" SourceVersion="Current">

</Parameter>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="String" Direction="Input" ParameterName="@MenuName" Precision="0"
ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="MenuName"
SourceColumnNullMapping="False" SourceVersion="Current">

</Parameter>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="Boolean" Direction="Input" ParameterName="@IsAvailable"
Precision="0" ProviderType="Bit" Scale="0" Size="0"
SourceColumn="IsAvailable" SourceColumnNullMapping="False"
SourceVersion="Current">

</Parameter>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="Int32" Direction="Input" ParameterName="@DisplayOrder" Precision="0"
ProviderType="Int" Scale="0" Size="0" SourceColumn="DisplayOrder"
SourceColumnNullMapping="False" SourceVersion="Current">

</Parameter>

<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
DbType="Int32" Direction="Input" ParameterName="@Original_MenuId"
Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MenuId"
SourceColumnNullMapping="False" SourceVersion="Original">

</Parameter>

</Parameters>

</DbCommand>

</UpdateCommand>

</DbSource>

</MainSource>

<Mappings>

<Mapping SourceColumn="MenuId" DataSetColumn="MenuId" />

<Mapping SourceColumn="LocationId" DataSetColumn="LocationId" />

<Mapping SourceColumn="MenuName" DataSetColumn="MenuName" />

<Mapping SourceColumn="IsAvailable" DataSetColumn="IsAvailable" />

<Mapping SourceColumn="DisplayOrder" DataSetColumn="DisplayOrder" />

</Mappings>

<Sources>

<DbSource ConnectionRef="ASPNETDBConnectionString (Web.config)"
DbObjectName="dbo.Menus" DbObjectType="Table" EnableWebMethods="False"
FillMethodModifier="Public" FillMethodName="FillMenusByLocation"
GenerateMethods="Both" GeneratePagingMethods="False"
GenerateShortCommands="True" GetMethodName="GetMenusByLocation"
QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
UseOptimisticConcurrency="True">

<SelectCommand>

<DbCommand CommandType="Text" ModifiedByUser="True">

<CommandText>SELECT MenuId, MenuName, IsAvailable, DisplayOrder

FROM Menus

WHERE (LocationId = @parameter1)</CommandText>

<Parameters>

<Parameter AllowDbNull="False" AutogeneratedName="parameter1"
ColumnName="LocationId"
DataSourceName="[C:\SHARE\xyzzy\xyzzy\APP_DATA\ASPNETDB.MDF].dbo.Menus"
DataTypeServer="int" DbType="Int32" Direction="Input"
ParameterName="@parameter1" Precision="0" ProviderType="Int" Scale="0"
Size="4" SourceColumn="LocationId" SourceColumnNullMapping="False"
SourceVersion="Current">

</Parameter>

</Parameters>

</DbCommand>

</SelectCommand>

</DbSource>

</Sources>

</TableAdapter>
 
S

Steven Cheng[MSFT]

Hi Dotnet,

Thanks for your posting. Regarding on this issue, I'll continue to followup
in your former thread in the ado.net newsgroup. Please feel free to post
there if you have any further concerns.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Dotnet Gruven" <[email protected]>
| Subject: Error: ObjectDataSource 'ObjectDataSource1' could not find a
non-generic method 'FillMenusByLocation' that has parameters: @locationId
| Date: Tue, 13 Sep 2005 20:20:23 -0400
| Lines: 302
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-128-25-74.hsd1.ma.comcast.net 24.128.25.74
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:124384
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I've posted this in the adonet group, however it was suggested I might
have
| better luck here....
| =============================================================
| I'm trying to use a typed dataset and ObjectDataSource binding to a SQLX
db
| using a foreign key to filter the returned result set to display in a
| GridView.
|
| The error message in the subject line is generated when I try to bind the
| following GridView to the ObjectSource that follows and the code that
| follows that which is from an ASP.NET form PageLoad:
| ------------------------------- mypage.ascx ---------------------------
| <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
| DeleteMethod="Delete" InsertMethod="Insert"
| SelectMethod="FillMenusByLocation"
|
| TypeName="RestaurantsTableAdapters.MenusTableAdapter"
| UpdateMethod="Update">
|
| <DeleteParameters>
|
| <asp:parameter Name="Original_MenuId" Type="Int32" />
|
| </DeleteParameters>
|
| <UpdateParameters>
|
| <asp:parameter Name="LocationId" Type="Int32" />
|
| <asp:parameter Name="MenuName" Type="String" />
|
| <asp:parameter Name="IsAvailable" Type="Boolean" />
|
| <asp:parameter Name="DisplayOrder" Type="Int32" />
|
| <asp:parameter Name="Original_MenuId" Type="Int32" />
|
| </UpdateParameters>
|
| <InsertParameters>
|
| <asp:parameter Name="LocationId" Type="Int32" />
|
| <asp:parameter Name="MenuName" Type="String" />
|
| <asp:parameter Name="IsAvailable" Type="Boolean" />
|
| <asp:parameter Name="DisplayOrder" Type="Int32" />
|
| </InsertParameters>
|
| </asp:ObjectDataSource>
|
| <asp:GridView ID="MenusGridView" Runat="server"
| DataSourceID="ObjectDataSource1" DataKeyNames="LocationId" ShowHeader=True
| AutoGenerateColumns="False"
| CellPadding="4" ForeColor="#333333" GridLines="Both" >
|
| <Columns>
|
| <asp:BoundField ReadOnly="True" HeaderText="MenuId"
DataField="MenuId"
| SortExpression="MenuId" Visible=True />
|
| <asp:BoundField ReadOnly="True" HeaderText="LocationId"
| DataField="LocationId" SortExpression="LocationId" Visible=True />
|
| <asp:BoundField HeaderText="Name" DataField="MenuName"
| SortExpression="MenuName" />
|
| <asp:CheckBoxField HeaderText="Available?" DataField="IsAvailable"
| SortExpression="IsAvailable" ItemStyle-HorizontalAlign="Center" />
|
| <asp:BoundField HeaderText="DisplayOrder" DataField="DisplayOrder"
| SortExpression="DisplayOrder" />
|
| </Columns>
|
|
|
|
| </asp:GridView>
|
| --------- From Page_Load !IsPostBack
|
| ObjectDataSource1.SelectParameters.Add("@parameter1", TypeCode.Int32,
| locationId.ToString());
|
| ----------
| Here is the XSD for the related TableAdapter
|
|
| <TableAdapter BaseClass="System.ComponentModel.Component"
| DataAccessorName="MenusTableAdapter" Modifier="AutoLayout, AnsiClass,
Class,
| Public" Name="Menus" WebServiceAttribute="False">
|
| <MainSource>
|
| <DbSource ConnectionRef="ASPNETDBConnectionString (Web.config)"
| DbObjectName="dbo.Menus" DbObjectType="Table" EnableWebMethods="False"
| FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both"
| GeneratePagingMethods="False" GenerateShortCommands="True"
| GetMethodName="GetData" QueryType="Rowset"
ScalarCallRetval="System.Object,
| mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
| UseOptimisticConcurrency="False">
|
| <DeleteCommand>
|
| <DbCommand CommandType="Text" ModifiedByUser="False">
|
| <CommandText>DELETE FROM [dbo].[Menus] WHERE (([MenuId] =
| @Original_MenuId))</CommandText>
|
| <Parameters>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="Int32" Direction="Input" ParameterName="@Original_MenuId"
| Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MenuId"
| SourceColumnNullMapping="False" SourceVersion="Original">
|
| </Parameter>
|
| </Parameters>
|
| </DbCommand>
|
| </DeleteCommand>
|
| <InsertCommand>
|
| <DbCommand CommandType="Text" ModifiedByUser="False">
|
| <CommandText>INSERT INTO [dbo].[Menus] ([LocationId], [MenuName],
| [IsAvailable], [DisplayOrder]) VALUES (@LocationId, @MenuName,
@IsAvailable,
| @DisplayOrder)</CommandText>
|
| <Parameters>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="Int32" Direction="Input" ParameterName="@LocationId" Precision="0"
| ProviderType="Int" Scale="0" Size="0" SourceColumn="LocationId"
| SourceColumnNullMapping="False" SourceVersion="Current">
|
| </Parameter>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="String" Direction="Input" ParameterName="@MenuName" Precision="0"
| ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="MenuName"
| SourceColumnNullMapping="False" SourceVersion="Current">
|
| </Parameter>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="Boolean" Direction="Input" ParameterName="@IsAvailable"
| Precision="0" ProviderType="Bit" Scale="0" Size="0"
| SourceColumn="IsAvailable" SourceColumnNullMapping="False"
| SourceVersion="Current">
|
| </Parameter>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="Int32" Direction="Input" ParameterName="@DisplayOrder"
Precision="0"
| ProviderType="Int" Scale="0" Size="0" SourceColumn="DisplayOrder"
| SourceColumnNullMapping="False" SourceVersion="Current">
|
| </Parameter>
|
| </Parameters>
|
| </DbCommand>
|
| </InsertCommand>
|
| <SelectCommand>
|
| <DbCommand CommandType="Text" ModifiedByUser="True">
|
| <CommandText>SELECT MenuId, LocationId, MenuName, IsAvailable,
DisplayOrder
| FROM Menus</CommandText>
|
| <Parameters>
|
| </Parameters>
|
| </DbCommand>
|
| </SelectCommand>
|
| <UpdateCommand>
|
| <DbCommand CommandType="Text" ModifiedByUser="False">
|
| <CommandText>UPDATE [dbo].[Menus] SET [LocationId] = @LocationId,
[MenuName]
| = @MenuName, [IsAvailable] = @IsAvailable, [DisplayOrder] = @DisplayOrder
| WHERE (([MenuId] = @Original_MenuId))</CommandText>
|
| <Parameters>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="Int32" Direction="Input" ParameterName="@LocationId" Precision="0"
| ProviderType="Int" Scale="0" Size="0" SourceColumn="LocationId"
| SourceColumnNullMapping="False" SourceVersion="Current">
|
| </Parameter>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="String" Direction="Input" ParameterName="@MenuName" Precision="0"
| ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="MenuName"
| SourceColumnNullMapping="False" SourceVersion="Current">
|
| </Parameter>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="Boolean" Direction="Input" ParameterName="@IsAvailable"
| Precision="0" ProviderType="Bit" Scale="0" Size="0"
| SourceColumn="IsAvailable" SourceColumnNullMapping="False"
| SourceVersion="Current">
|
| </Parameter>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="Int32" Direction="Input" ParameterName="@DisplayOrder"
Precision="0"
| ProviderType="Int" Scale="0" Size="0" SourceColumn="DisplayOrder"
| SourceColumnNullMapping="False" SourceVersion="Current">
|
| </Parameter>
|
| <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName=""
| DbType="Int32" Direction="Input" ParameterName="@Original_MenuId"
| Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MenuId"
| SourceColumnNullMapping="False" SourceVersion="Original">
|
| </Parameter>
|
| </Parameters>
|
| </DbCommand>
|
| </UpdateCommand>
|
| </DbSource>
|
| </MainSource>
|
| <Mappings>
|
| <Mapping SourceColumn="MenuId" DataSetColumn="MenuId" />
|
| <Mapping SourceColumn="LocationId" DataSetColumn="LocationId" />
|
| <Mapping SourceColumn="MenuName" DataSetColumn="MenuName" />
|
| <Mapping SourceColumn="IsAvailable" DataSetColumn="IsAvailable" />
|
| <Mapping SourceColumn="DisplayOrder" DataSetColumn="DisplayOrder" />
|
| </Mappings>
|
| <Sources>
|
| <DbSource ConnectionRef="ASPNETDBConnectionString (Web.config)"
| DbObjectName="dbo.Menus" DbObjectType="Table" EnableWebMethods="False"
| FillMethodModifier="Public" FillMethodName="FillMenusByLocation"
| GenerateMethods="Both" GeneratePagingMethods="False"
| GenerateShortCommands="True" GetMethodName="GetMenusByLocation"
| QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib,
| Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
| UseOptimisticConcurrency="True">
|
| <SelectCommand>
|
| <DbCommand CommandType="Text" ModifiedByUser="True">
|
| <CommandText>SELECT MenuId, MenuName, IsAvailable, DisplayOrder
|
| FROM Menus
|
| WHERE (LocationId = @parameter1)</CommandText>
|
| <Parameters>
|
| <Parameter AllowDbNull="False" AutogeneratedName="parameter1"
| ColumnName="LocationId"
| DataSourceName="[C:\SHARE\xyzzy\xyzzy\APP_DATA\ASPNETDB.MDF].dbo.Menus"
| DataTypeServer="int" DbType="Int32" Direction="Input"
| ParameterName="@parameter1" Precision="0" ProviderType="Int" Scale="0"
| Size="4" SourceColumn="LocationId" SourceColumnNullMapping="False"
| SourceVersion="Current">
|
| </Parameter>
|
| </Parameters>
|
| </DbCommand>
|
| </SelectCommand>
|
| </DbSource>
|
| </Sources>
|
| </TableAdapter>
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top