Sep 16, 2013, 3:13 AM
SqlDataSource cannot get value from DeleteParameters
I have a SqlDataSource binding with a grid panel.
DeleteCommand as follow
What I find is the parameter is declared in the deleting
This code return true
following return null
Is there any possible reason??
DeleteCommand as follow
DeleteCommand = "DELETE FROM TMPTM101DT2 WHERE TMDUSRID = @TMDUSRID AND TMDCMPNO = @TMDCMPNO AND TMDLABEL = @TMDLABEL AND TMDDTETIM = @TMDDTETIM"
and UpdateCommandUpdateCommand="UPDATE TMPTM101DT2 SET
TMDNOMINAT = @TMDNOMINAT,
TMDENDBUY = @TMDENDBUY,
TMDRMK = @TMDRMK,
TMDCRTUSR = @TMDCRTUSR,
TMDCRTDTE = @TMDCRTDTE,
TMDLUPUSR = @TMDLUPUSR,
TMDLUPDTE = @TMDLUPDTE
WHERE TMDUSRID = @TMDUSRID AND TMDCMPNO = @TMDCMPNO AND TMDLABEL = @TMDLABEL AND TMDDTETIM = @TMDDTETIM">
The DeleteParameters and UpdateParameters are declared in same way and DeleteParameters just contains the keys. <DeleteParameters>
<asp:Parameter Name="TMDUSRID" Type="String"/>
<asp:Parameter Name="TMDDTETIM" Type="DateTime"/>
<asp:Parameter Name="TMDCMPNO" Type="String"/>
<asp:Parameter Name="TMDLABEL" Type="String"/>
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="TMDUSRID" Type="String"/>
<asp:Parameter Name="TMDDTETIM" Type="DateTime"/>
<asp:Parameter Name="TMDCMPNO" Type="String"/>
<asp:Parameter Name="TMDLABEL" Type="String"/>
<asp:Parameter Name="TMDNOMINAT" Type="Int16"/>
<asp:Parameter Name="TMDENDBUY" Type="String"/>
<asp:Parameter Name="TMDRMK" Type="String"/>
<asp:Parameter Name="TMDCRTUSR" Type="String"/>
<asp:Parameter Name="TMDCRTDTE" Type="DateTime"/>
<asp:Parameter Name="TMDLUPUSR" Type="String"/>
<asp:Parameter Name="TMDLUPDTE" Type="DateTime"/>
</UpdateParameters>
In this case, the update is work fine. However deleting is not work. I insert a break point at the event of onDeleting.What I find is the parameter is declared in the deleting
This code return true
e.Command.Parameters.Contains("@TMDUSRID")
but the value is null.following return null
e.Command.Parameters["@TMDUSRID"].Value
the Store of the gridpanel is declared like this <Store>
<ext:Store ID="stoLbl" runat="server" DataSourceID="sdsLbl" OnAfterRecordInserted="stoLbl_OnAfterRecordInserted" OnBeforeRecordInserted="stoLbl_OnBeforeRecordInserted">
<Model>
<ext:Model ID="Model3" runat="server" Name="Label" >
<Fields>
<ext:ModelField Name="TMDUSRID" ServerMapping="TMDUSRID"/>
<ext:ModelField Name="TMDDTETIM" ServerMapping="TMDDTETIM"/>
<ext:ModelField Name="TMDCMPNO" ServerMapping="TMDCMPNO"/>
<ext:ModelField Name="TMDCRTUSR" ServerMapping="TMDCRTUSR"/>
<ext:ModelField Name="TMDCRTDTE" ServerMapping="TMDCRTDTE"/>
<ext:ModelField Name="TMDLUPUSR" ServerMapping="TMDLUPUSR"/>
<ext:ModelField Name="TMDLUPDTE" ServerMapping="TMDLUPDTE"/>
<ext:ModelField Name="TMDLABEL" ServerMapping="TMDLABEL"/>
<ext:ModelField Name="TMDNOMINAT" ServerMapping="TMDNOMINAT" Type="Boolean"/>
<ext:ModelField Name="TMDENDBUY" ServerMapping="TMDENDBUY"/>
<ext:ModelField Name="TMDRMK" ServerMapping="TMDRMK"/>
</Fields>
</ext:Model>
</Model>
<Listeners>
<Exception Handler="Ext.Msg.alert('Operation failed', operation.getError());" />
<Write Handler="Ext.Msg.alert('Write', 'The data successfully saved');" />
</Listeners>
</ext:Store>
</Store>
I do the same thing at the event of Updating, those parameters work fine and get value.Is there any possible reason??
Last edited by Vinci; Sep 16, 2013 at 3:47 AM.