在下面的示例中,我的 Foo 参数的默认值传递了一个 null
值而不是 string.Empty
<asp:ObjectDataSource ID="MyDataSource" runat="server" SelectMethod="GetAll"
UpdateMethod="MyUpdateMethod" TypeName="My.Namespace.MyProvider">
<UpdateParameters>
<asp:Parameter Name="Key" Type="Int16" />
<asp:Parameter Name="Foo" Type="String" DefaultValue="" />
</UpdateParameters>
</asp:ObjectDataSource>
虽然我可以在 MyUpdateMethod
中处理它,但有没有办法将字符串参数的 DefaultValue
设置为空字符串?
最佳答案
<asp:Parameter Name="Foo" Type="String" ConvertEmptyStringToNull="false" />
关于c# - 如何在 ObjectDataSource 方法中将参数默认值设置为空字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9163848/