471,306 Members | 996 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

Error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'FillMenusByLocation' that has parameters: @locationId

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.MenusTableAdapt er"
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("@parameter 1", 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>
Nov 19 '05 #1
1 5027
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" <do**********@newsgroup.nospam>
| 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: <e2*************@TK2MSFTNGP12.phx.gbl>
| 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!TK2MSFT NGP12.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.MenusTableAdapt er"
| 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("@parameter 1", 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>
|
|
|

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by bor_kev | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.