Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   objectdataSource case sensitive with parameters?? (http://www.velocityreviews.com/forums/t778768-objectdatasource-case-sensitive-with-parameters.html)

Trapulo 08-24-2006 02:21 PM

objectdataSource case sensitive with parameters??
 
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





Steven Cheng[MSFT] 08-25-2006 07:40 AM

RE: objectdataSource case sensitive with parameters??
 
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/subscripti...ult.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/subscripti...t/default.aspx.

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



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


Trapulo 08-26-2006 09:34 AM

Re: objectdataSource case sensitive with parameters??
 
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


"Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message
news:njcBEnByGHA.400@TK2MSFTNGXA01.phx.gbl...
> 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
>
>
>



Trapulo 08-26-2006 09:40 AM

Re: objectdataSource case sensitive with parameters??
 
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>



"Trapulo" <trapulo@noemail.noemail> wrote in message
news:O687TLPyGHA.4092@TK2MSFTNGP04.phx.gbl...
> 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>




Trapulo 08-26-2006 09:46 AM

Re: objectdataSource case sensitive with parameters??
 
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.ObjectDataSourceSelectin gEventArgs) Handles
dsLogs.Selecting
e.InputParameters("logStatus") =
BusinessEntities.ActivityLog.ActivityLogStatus.ana lyzed

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...



"Trapulo" <trapulo@noemail.noemail> wrote in message
news:edoWtOPyGHA.3428@TK2MSFTNGP02.phx.gbl...
>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>
>
>
>
> "Trapulo" <trapulo@noemail.noemail> wrote in message
> news:O687TLPyGHA.4092@TK2MSFTNGP04.phx.gbl...
>> 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>

>
>




Steven Cheng[MSFT] 08-28-2006 02:18 AM

Re: objectdataSource case sensitive with parameters??
 
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.



All times are GMT. The time now is 08:06 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.