
Signature
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.
Hi kevin,
Thanks for your reply.
My code is given below
*--------------------------------------
Private Sub LocContracts()
Dim OnlineConnection As New OnlineConnection
Dim Sql, SqlComm, SqlDR
Dim Branch = "ABHN"
Dim DBConnection = OnlineConnection.OnlineDBConnection
(Database)
Dim Trans As SqlClient.SqlTransaction =
DBConnection.BeginTransaction(IsolationLevel.ReadCommitted)
Sql = "Update Applications Set ContractType = 5,Repayment =
Case "
Sql = Sql & " when (LoanAmount * 3 / 100) > 40 Then
(LoanAmount * 3 /100)"
Sql = Sql & " else 40 End "
Sql = Sql & " where BranchId in ( Select BranchId from Branch
where BranchName = '" & Branch & "')"
Sql = Sql & " And ContractType = 0"
SqlComm = New SqlCommand(Sql, DBConnection)
SqlComm.Transaction = Trans
SqlDR = SqlComm.ExecuteReader()
Trans.Commit()
SqlDR.Close()
SqlComm = Nothing
Sql = Nothing
OnlineConnection = Nothing
End Sub
*--------------------------------------
In this code, Line 396 is given below.
Dim Trans As SqlClient.SqlTransaction =
DBConnection.BeginTransaction(IsolationLevel.ReadCommitted)
Hope you can sort this out.
Thanks,
Majo
> Did you look at ViewApplicationExtraction.aspx.vb:396
>
[quoted text clipped - 63 lines]
> >
> > *--------------------------------------
Kevin Spencer - 16 Mar 2006 12:56 GMT
Hi majo,
Dim Trans As SqlClient.SqlTransaction =
DBConnection.BeginTransaction(IsolationLevel.ReadCommitted)
I would suspect that DBConnection is Nothing when this exception occurs.
Make sure that it is always created beforehand. If you are sure that it is
always created, it is possible that something has caused the connection to
the database to be interrupted.

Signature
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.
> Hi kevin,
>
[quoted text clipped - 119 lines]
>> >
>> > *--------------------------------------
majo - 17 Mar 2006 02:01 GMT
Hi kevin
Iam sure that DBConnection is always created beforehand.
Can you tell me the possible causes for the connection to get interrupted ?
Rgds,
Majo.
> Hi majo,
>
[quoted text clipped - 129 lines]
> >> >
> >> > *--------------------------------------