How to declare variable which can be used in multiple function, except define at Class level, and thkx to previous answer, tkx again
Public class1 class
Dim trans As SqlTransaction = myconnection.BeginTransaction -----------> the trans is defined here after open and cannot define at class since error found in runtine if dim before open connection
Dim updatedetail As New SqlCommand
updatedetail.Connection = myconnection
updatedetail.Transaction = trans
Function2(Byval wk_temp as string)
updatedetail.CommandText = "Update staff_info set AL_temp = '"& wk_temp & "'"
Catch ex As Exception
trans.Rollback() ---------------------> since the trans here is defined at function1, thus error of undefined
Your kindly assistance is highly appreciate....