Hi!
I have created a repeating table in InfoPath 2013 which looks like the following:
Id Cancel Cancelled reason
1 Cancel button Text box
2 Cancel button Text box
When the user clicks on the ‘Cancel’ button a SQL stored procedure is called. The stored procedure requires two parameters, the ID of the record and the cancelled reason (which the user will enter in the text box).
This is the C# code behind the button:
public void CTRL110_5_Clicked(object sender, ClickedEventArgs e)
{
XPathNavigator dom = MainDataSource.CreateNavigator();
string cancelledreason = dom.SelectSingleNode(
"/dfs:myFields/dfs:dataFields/ns1:SharePointListItem_RW/ns1:CancelledReason", NamespaceManager).Value;
XPathNavigator dom2 = MainDataSource.CreateNavigator();
string RId = dom2.SelectSingleNode(
"/dfs:myFields/dfs:dataFields/ns1:SharePointListItem_RW/ns1:RId ", NamespaceManager).Value;
AdoQueryConnection connection = (AdoQueryConnection)DataConnections["conn"];
string userName = null;
SPClaimProviderManager mgr = SPClaimProviderManager.Local;
if (mgr != null)
{
userName = mgr.DecodeClaim(SPContext.Current.Web.CurrentUser.LoginName).Value;
}
string originalCommand = connection.Command;
connection.Command = "EXEC SP_Cancel '" + cancelledreason + " - " + userName + "'," + "'" + RId + "'";
connection.Execute();
connection.Command = originalCommand;
}
When I click on the cancel button a value of null is only available for cancelledreason and RId.
Please can you assist with helping me resolve it?
Cheers,
Helen