A quick way of using sql executeNonQuery Method of sqlCommand
' ----------------------------------------
' Required Imports :
'
' System.Data
' System.Data.SqlClient
' ----------------------------------------
Dim rowCount As Integer
Dim previousConnectionState As ConnectionState
previousConnectionState = conn.State
Try
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
rowCount = cmd.ExecuteNonQuery()
Finally
If previousConnectionState = ConnectionState.Closed Then
conn.Close()
End If
End Try
2 comments:
simple and clear
really.. Faster than Ado tech
Post a Comment