Timeout Expire on INSERT Query

Posted by Sachin Gaur on Stack Overflow See other posts from Stack Overflow or by Sachin Gaur
Published on 2009-03-19T14:43:59Z Indexed on 2010/05/27 9:01 UTC
Read the original article Hit count: 158

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about sql-server-2005