objectdataSource case sensitive with parameters??

T

Trapulo

I'have this error on a runtime page:
ObjectDataSource 'dataSourceActivityLogs' could not find a non-generic
method 'GetActivityLogsCount' that has parameters: veichleID, originalName,
status.

My class has this method declared:
Public Function GetActivityLogsCount(ByVal veichleID As Nullable(Of Int32),
ByVal originalName As String, ByVal Status As Nullable(Of
BusinessEntities.ActivityLog.ActivityLogStatus)) As Int32

I noticed that if "Status" is writted capitalized, I have the error. If it
is written as "status", the objectdatasource works. My big problem is that I
have an other datasource, in the same asp.net project, that raises the error
only if parameter is written as "status" and works only if I write
"Status"!!! :((

This is the objectdatasource declaration:

<asp:ObjectDataSource ID="dataSourceActivityLogs" runat="server"
EnablePaging="True"

EnableViewState="False" OldValuesParameterFormatString="original_{0}"
SelectCountMethod="GetActivityLogsCount"

SelectMethod="GetActivityLogs" TypeName="DataSources.ActivityLogs">

<SelectParameters>

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

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

<asp:parameter DefaultValue="2" Name="status" Type="Object" />

</SelectParameters>

</asp:ObjectDataSource>



Whis this behavor?? How can I solve this?



thanks
 
S

Steven Cheng[MSFT]

Hello Trapulo,

It seems you're encountering some method paramter mismatching error when
using ObjectDataSource control in ASP.NET page.

I've ever met some issue with similar error which is caused by the paramter
type or count mismatch. However, the problem in your case seems a bit
strange as you said the "Status" paramter will work for one datasource but
not for anotehr one.

Have you tried comparing the two datasource's declaration in the aspx
template to see whether there is any difference between them? Also, you can
try copying them onto the same page to see what's the behavior.

If convenient, you can create a simplified business class(with some hard
coded dummy datas) which can reproduct the problem so that I can also
perform some tests on my local side.

Please feel free to let me know if there is any other finding.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Trapulo

Hello Steven,
I made some other test, and it seems the problem is related to the name
"status". Now I've this problem on others datasources. I've tried to rename
the param, and this is how the error has changed:

ObjectDataSource 'dsLogs' could not find a non-generic method
'GetActivityLogs' that has parameters: veichleID, originalName, logStatus,
Status, maximumRows, startRowIndex.
As you can see, my parameter has been called "logStatus", but the datasource
is still looking for a "Status" parameter... :(

This is the datasource that is raising that error:

<asp:ObjectDataSource ID="dsLogs" runat="server" EnablePaging="True"
EnableViewState="False" OldValuesParameterFormatString="original_{0}"
SelectCountMethod="GetActivityLogsCount"

SelectMethod="GetActivityLogs" TypeName="DataSources.ActivityLogs">

<SelectParameters>

<asp:ControlParameter ControlID="ddlVeichles" DefaultValue="0"
Name="veichleID" PropertyName="SelectedValue" Type="Int32" />

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

<asp:parameter DefaultValue="2" Name="logStatus" Type="Object" />

</SelectParameters>

</asp:ObjectDataSource>



And this is the target method:



Public Function GetActivityLogs(ByVal veichleID As Nullable(Of Int32), ByVal
originalName As String, _

ByVal logStatus As Nullable(Of
BusinessEntities.ActivityLog.ActivityLogStatus), _

ByVal startRowIndex As Int32, ByVal maximumRows As Int32) As
BusinessEntities.LogsCollection



Dim filter As New BusinessEntities.Filters.FilterLog(originalName)

filter.StartRowIndex = startRowIndex

filter.MaximumRows = maximumRows

If veichleID.HasValue Then filter.Veichle = New
BusinessEntities.Veichle(veichleID.Value)

If logStatus.HasValue Then filter.Status = logStatus.Value



Dim out As BusinessEntities.LogsCollection =
Utils.FcdDataManagement.GetLogs(filter)

_totalRowsCache = filter.TotalRows

Return out

End Function
 
T

Trapulo

I add that I have, on an other page, this datasource that is working well:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
EnablePaging="True"

EnableViewState="False" OldValuesParameterFormatString="original_{0}"
SelectCountMethod="GetActivityLogsCount"

SelectMethod="GetActivityLogs" TypeName="DataSources.ActivityLogs">

<SelectParameters>

<asp:ControlParameter ControlID="ddlVeichles" DefaultValue="0"
Name="veichleID" PropertyName="SelectedValue"

Type="Int32" />

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

<asp:parameter Name="logStatus" Type="Object" />

</SelectParameters>

</asp:ObjectDataSource>
 
T

Trapulo

Ok, this was my error. When I tried to rename the parameter from "status" to
"logStatus", I forgot that I have this code-behind:

Protected Sub dsLogs_Selecting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs) Handles
dsLogs.Selecting
e.InputParameters("logStatus") =
BusinessEntities.ActivityLog.ActivityLogStatus.analyzed

End Sub

So, renaming the parameter from "status" to "logStatus" is a solution to my
problem: now all objectdataSources are working well and they all are calling
this methods:

Public Function GetActivityLogs(ByVal veichleID As Nullable(Of Int32), ByVal
originalName As String, _

ByVal logStatus As Nullable(Of
BusinessEntities.ActivityLog.ActivityLogStatus), _

ByVal startRowIndex As Int32, ByVal maximumRows As Int32) As
BusinessEntities.ActivityLogsCollection

and

Public Function GetActivityLogsCount(ByVal veichleID As Nullable(Of Int32),
ByVal originalName As String, _

ByVal logStatus As Nullable(Of
BusinessEntities.ActivityLog.ActivityLogStatus)) As Int32



I think there is some problem when a parameter is called "status" ..... very
strange, but renamig it solve my problem...
 
S

Steven Cheng[MSFT]

Thanks for your followup Trapulo,

Glad that you've figured out the problem.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top