Hi all,
I have a form in Infopath 2010 to perform some CRUD operations on a table in my sql server database. For all operations I have a stored procedure that's been called when I push on the corresponding button. Create en update just works perfect! Only my delete operation is not..
Below my code:
Public
Sub btnDeleteSubject_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)Dim dom As XPathNavigator = MainDataSource.CreateNavigator()
Dim subjectStringID As String = dom.SelectSingleNode("//my:txtSubjectID", NamespaceManager).Value
' Retrieve the connection to the database tableDim connection As AdoQueryConnection = DataConnections("SubjectConnection")
' Save the original statement that is stored in the Command propertyDim originalCommand As String = connection.Command
' Execute the stored procedure
connection.Command =
"EXECUTE [General_Purpose].[dbo].[usp_tblSubjectDelete] '" & subjectStringID & "'"
connection.Execute()
' Restore the statement of the Command property to its original value
connection.Command = originalCommand
End Sub
If I copy the value of connection.Command just before connection.Execute() and I run this command in my sql server management studio all works perfect.. But in code it just doens't delete anything.. It's not throwing any error and the statement that has to be executed just works.
Any explanation for this?
Thx in advance,
Neil.