I am trying to insert a row in a table using simple INSERT Query in a transaction. It works fine in SQL Server but I am not able to insert the data using my business object.
I am calling a SELECT query using the Command as:
Using cm As New SqlCommand
With cm
.Connection = tr.Connection
.Transaction = tr
.CommandType = CommandType.Text
.CommandText = Some Select Query
.ExecuteScalar()
'' Do something
.CommandText = Insert Query
.ExecuteNonQuery()
End With
End Using
I am getting the Timeout period expired error at ".ExecuteNonQuery()" line.
Any other DML query is running perfectly fine at this point.
Can anyone tell me the reason?