Server Error

G

Guest

Hi,

I had posted this once earlier, but couldnt get my problem solved.
When i run an asp.net application in windows 2003 server with IIS 6.0, it
"SOMETIMES" gives me the below given error. Please note that it gives this
error only ONCE IN A WHILE.

To test if this error has anything to do with the server, I xcopied the same
application to a new virtual directory in the same server.

When i was getting the server error in the first application, i tried
running the application in the virtual directory. It worked well without any
error.

I assume that it has something to do with the concurrent user settings. can
anybody help please.

Thanks in advance,
Majo

*--------------------------------------

Server Error in '/CreditApplication' Application.
________________________________________
Object variable or With block variable not set.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object variable or With
block variable not set.

Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object variable or With block variable not set.]

Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type
objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
+934

Extraction.ViewApplication.LocContracts() in
D:\CreditApplication-1.0H\ViewApplication\ViewApplicationExtraction.aspx.vb:396

Extraction.ViewApplication.Page_Load(Object sender, EventArgs e) in
D:\CreditApplication-1.0H\ViewApplication\ViewApplicationExtraction.aspx.vb:54

System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300

*--------------------------------------
 
K

Kevin Spencer

Did you look at ViewApplicationExtraction.aspx.vb:396


--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.
 
K

Kevin Spencer

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.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

majo said:
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


Kevin Spencer said:
Did you look at ViewApplicationExtraction.aspx.vb:396


--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

majo said:
Hi,

I had posted this once earlier, but couldnt get my problem solved.
When i run an asp.net application in windows 2003 server with IIS 6.0,
it
"SOMETIMES" gives me the below given error. Please note that it gives
this
error only ONCE IN A WHILE.

To test if this error has anything to do with the server, I xcopied the
same
application to a new virtual directory in the same server.

When i was getting the server error in the first application, i tried
running the application in the virtual directory. It worked well
without
any
error.

I assume that it has something to do with the concurrent user settings.
can
anybody help please.

Thanks in advance,
Majo

*--------------------------------------

Server Error in '/CreditApplication' Application.
________________________________________
Object variable or With block variable not set.
Description: An unhandled exception occurred during the execution of
the
current web request. Please review the stack trace for more information
about
the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object variable or
With
block variable not set.

Source Error:
An unhandled exception was generated during the execution of the
current
web
request. Information regarding the origin and location of the exception
can
be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object variable or With block variable not
set.]

Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o,
Type
objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack)
+934

Extraction.ViewApplication.LocContracts() in
D:\CreditApplication-1.0H\ViewApplication\ViewApplicationExtraction.aspx.vb:396

Extraction.ViewApplication.Page_Load(Object sender, EventArgs e) in
D:\CreditApplication-1.0H\ViewApplication\ViewApplicationExtraction.aspx.vb:54

System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.2300;
ASP.NET
Version:1.1.4322.2300

*--------------------------------------
 
G

Guest

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.



Kevin Spencer said:
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.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

majo said:
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


Kevin Spencer said:
Did you look at ViewApplicationExtraction.aspx.vb:396


--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

Hi,

I had posted this once earlier, but couldnt get my problem solved.
When i run an asp.net application in windows 2003 server with IIS 6.0,
it
"SOMETIMES" gives me the below given error. Please note that it gives
this
error only ONCE IN A WHILE.

To test if this error has anything to do with the server, I xcopied the
same
application to a new virtual directory in the same server.

When i was getting the server error in the first application, i tried
running the application in the virtual directory. It worked well
without
any
error.

I assume that it has something to do with the concurrent user settings.
can
anybody help please.

Thanks in advance,
Majo

*--------------------------------------

Server Error in '/CreditApplication' Application.
________________________________________
Object variable or With block variable not set.
Description: An unhandled exception occurred during the execution of
the
current web request. Please review the stack trace for more information
about
the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object variable or
With
block variable not set.

Source Error:
An unhandled exception was generated during the execution of the
current
web
request. Information regarding the origin and location of the exception
can
be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object variable or With block variable not
set.]

Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o,
Type
objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack)
+934

Extraction.ViewApplication.LocContracts() in
D:\CreditApplication-1.0H\ViewApplication\ViewApplicationExtraction.aspx.vb:396

Extraction.ViewApplication.Page_Load(Object sender, EventArgs e) in
D:\CreditApplication-1.0H\ViewApplication\ViewApplicationExtraction.aspx.vb:54

System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.2300;
ASP.NET
Version:1.1.4322.2300

*--------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top