All of a Sudden , Sql Server Timeout

Posted by Adinochestva on Stack Overflow See other posts from Stack Overflow or by Adinochestva
Published on 2010-05-25T10:02:12Z Indexed on 2010/05/25 10:21 UTC
Read the original article Hit count: 138

Filed under:
|
|

Hey Guys We got a legacy vb.net applicaction that was working for years But all of a sudden it stops working yesterday and gives sql server timeout Most part of application gives time out error , one part for example is below code :

command2 = New SqlCommand("select * from Acc order by AccDate,AccNo,AccSeq", SBSConnection2)
        reader2 = command2.ExecuteReader()
    If reader2.HasRows() Then
        While reader2.Read()
            If IndiAccNo <> reader2("AccNo") Then
                CAccNo = CAccNo + 1
                CAccSeq = 10001
                IndiAccNo = reader2("AccNo")
            Else
                CAccSeq = CAccSeq + 1
           End If
            command3 = New SqlCommand("update Acc Set AccNo=@NewAccNo,AccSeq=@NewAccSeq where AccNo=@AccNo and AccSeq=@AccSeq", SBSConnection3)
            command3.Parameters.Add("@AccNo", SqlDbType.Int).Value = reader2("AccNo")
        command3.Parameters.Add("@AccSeq", SqlDbType.Int).Value = reader2("AccSeq")
          command3.Parameters.Add("@NewAccNo", SqlDbType.Int).Value = CAccNo
        command3.Parameters.Add("@NewAccSeq", SqlDbType.Int).Value = CAccSeq

      command3.ExecuteNonQuery()
    End While
End If

It was working and now gives time out in command3.ExecuteNonQuery() Any ideas ?

© Stack Overflow or respective owner

Related posts about sql

Related posts about vb.net