|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Anyone know how to get the return value from the query below? It was stated in the help files --- For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. Below is the normal way i did in vb.net, but how to check if the return value. Please help. ======== Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As SqlConnection) Dim myCommand As New SqlCommand(myExecuteQuery, myConnection) myCommand.Connection.Open() myCommand.ExecuteNonQuery() myConnection.Close() End Sub 'CreateMySqlCommand ======== Thank you. |
|
#2
|
|||
|
|||
|
I managed to find a solution, thanks to Kishore and StudioReview. For those who are interested, below are the updated code.
Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As SqlConnection) Dim myCommand As New SqlCommand(myExecuteQuery, myConnection) Dim rowsAffected as Integer myCommand.Connection.Open() ' rowsaffrected will store the return value of affected rows rowsAffected = myCommand.ExecuteNonQuery() myConnection.Close() End Sub 'CreateMySqlCommand |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > How to get the return value? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|