i need to use this :
Private Shared Sub Demo1()
Dim db As SqlConnection = New SqlConnection(" connstringhere" )
Dim transaction As SqlTransaction
db.Open
transaction = db.BeginTransac tion
Try
call (New SqlCommand("INS ERT INTO TransactionDemo " + "(Text)
VALUES ('Row1');", db, transaction)).E xecuteNonQuery
call (New SqlCommand("INS ERT INTO TransactionDemo " + "(Text)
VALUES ('Row2');", db, transaction)).E xecuteNonQuery
call (New SqlCommand("INS ERT INTO CrashMeNow VALUES " + "('Die',
'Die', 'Die');", db, transaction)).E xecuteNonQuery
transaction.Com mit
Catch sqlError As SqlException
transaction.Rol lback
End Try
db.Close
End Sub
+++>>>> But how can i do this with a stored procedure each time ?
Call (New SqlCommand("myS P", myConnexion,
myTransaction)) .ExecuteNonQuer y()
but i need the command type : stored procedure and the parameters ????
how can i do ?
Private Shared Sub Demo1()
Dim db As SqlConnection = New SqlConnection(" connstringhere" )
Dim transaction As SqlTransaction
db.Open
transaction = db.BeginTransac tion
Try
call (New SqlCommand("INS ERT INTO TransactionDemo " + "(Text)
VALUES ('Row1');", db, transaction)).E xecuteNonQuery
call (New SqlCommand("INS ERT INTO TransactionDemo " + "(Text)
VALUES ('Row2');", db, transaction)).E xecuteNonQuery
call (New SqlCommand("INS ERT INTO CrashMeNow VALUES " + "('Die',
'Die', 'Die');", db, transaction)).E xecuteNonQuery
transaction.Com mit
Catch sqlError As SqlException
transaction.Rol lback
End Try
db.Close
End Sub
+++>>>> But how can i do this with a stored procedure each time ?
Call (New SqlCommand("myS P", myConnexion,
myTransaction)) .ExecuteNonQuer y()
but i need the command type : stored procedure and the parameters ????
how can i do ?
Comment