我有一个listview,在listview Update
命令中我试图设置我SqlDataSource UpdateParameters
属性中定义的参数。当Update
命令触发时,我收到一条错误消息,指出
程序或功能' MyStoredProcedure'期望参数' @ ReturnResult',这是未提供的。
这是使用SQL DataSource的aspx:
<asp:SqlDataSource ID="sqlDataForCustomers" runat="server"
ConnectionString="<%$ ConnectionStrings:GS_ConnectionString %>"
CancelSelectOnNullParameter="False"
SelectCommand="usp_WDE_Get_DG"
SelectCommandType="StoredProcedure"
UpdateCommand="usp_WDE_Save"
UpdateCommandType="StoredProcedure" >
<SelectParameters>
<asp:Parameter DefaultValue="0" Name="GID" Type="Int32" />
<asp:Parameter DefaultValue="0" Name="Order" Type="Int32" />
<asp:Parameter DefaultValue="0" Name="PID" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="PID" Type="Int32" />
<asp:Parameter Name="ProID" Type="Int32" />
<asp:Parameter Name="GID" Type="Int32" />
<asp:Parameter Name="DGapID" Type="Int32" />
<asp:Parameter Name="DEntryID" Type="Int32" />
<asp:Parameter Name="DEntrySetID" Type="Int32" />
<asp:Parameter Name="DEntryResult" Type="String" Size="250"/>
<asp:Parameter Name="DEServiceDate" Type="DateTime" />
<asp:Parameter Name="UserLoginID" Type="String" Size="50"/>
<asp:Parameter Name="UserPersonID" Type="Int32" />
<asp:Parameter Name="ServiceDate" Type="DateTime" />
<asp:Parameter Name="DGRowId" Type="Int32" />
<asp:Parameter Name="SRowId" Type="Int32" />
<asp:Parameter Direction="ReturnValue" Name="RetResult" Type="Boolean" DefaultValue="True" />
<asp:Parameter Direction="ReturnValue" Name="RetMsg" Type="String" Size="50" DefaultValue=""/>
</UpdateParameters>
这是后面代码中LV的ItemUpdating事件:
Sub CustomersGroupedByDataField_ItemUpdating(ByVal sender As Object, ByVal e As ListViewUpdateEventArgs) Handles CustomersGroupedByDataField.ItemUpdating
Dim rowValue As Integer = e.ItemIndex
Dim DataGapTypeBeingUpdated As String = CustomersGroupedByDataField.DataKeys.Item(rowValue).Value.ToString()
Dim boolTest As Boolean
boolTest = True
GetRowValues(DataGapTypeBeingUpdated)
CheckOOS()
sqlDataForCustomers.UpdateParameters("PID").DefaultValue = intPID.Value
sqlDataForCustomers.UpdateParameters("ProID").DefaultValue = intProID.Value
sqlDataForCustomers.UpdateParameters("GID").DefaultValue = intGID.Value
sqlDataForCustomers.UpdateParameters("DGapID").DefaultValue = intDGapID.Value
sqlDataForCustomers.UpdateParameters("DEntryID").DefaultValue = intDEntryID.Value
sqlDataForCustomers.UpdateParameters("DEntrySetID").DefaultValue = intDEntrySetID.Value
sqlDataForCustomers.UpdateParameters("DEntryResult").DefaultValue = strDEntryResultValue
sqlDataForCustomers.UpdateParameters("DEServiceDate").DefaultValue = CDate(dtServiceDate.Text)
sqlDataForCustomers.UpdateParameters("UserLoginID").DefaultValue = Convert.ToString(Session("LoginID"))
sqlDataForCustomers.UpdateParameters("UserPersonID").DefaultValue = Convert.ToString(Session("PersonID"))
sqlDataForCustomers.UpdateParameters("ServiceDate").DefaultValue = CDate(dtServiceDate.Text)
sqlDataForCustomers.UpdateParameters("DGRowID").DefaultValue = intDGapRowID.Value
sqlDataForCustomers.UpdateParameters("SRowID").DefaultValue = intSRowID.Value
End Sub
我不知道如何指定返回值作为参数?
如何处理Return值(RetResult&amp; RetMsg)?
感谢您的关注,
答案 0 :(得分:0)
select参数的direction属性将输入参数标记为参考参数。您的代码中可以访问相同的属性。
<SelectParameters>
<asp:Parameter Direction="ReturnValue" Name="MyReturnParameter" Type="Int32" />
</SelectParameters>
执行命令后,您可以使用parameter.Value检索值或将其绑定到ui元素。
答案 1 :(得分:0)
<property name="idGenerator">
<bean class="org.activiti.engine.impl.persistence.StrongUuidGenerator" />