473,800 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in Connection object

Hi there,
I have been having a nightmare with one of ASP .Net 2.0 app which works fine
in our development environment. WHen I move to the production server the
database is getting wacked. I am trying to establish a connection thro a XML
string. Everything works fine and I am able to connect to the specific
database and make queries with that connection object. But once I move to the
production server and try to connect to a specific database I am getting
screwed. It is establishing the database connection correctly in the
prodcution server but when I execute a query it returns 0 and I dont know
where I am going wrong. I am attaching herewith code snippet which is
misbehaving in the production server.

Sub getAWPRODDBValu es()
Dim cmd As New SqlCommand
Dim magStatus As String = ""
Dim mag3dStatus As String = ""
Dim strException As String = ""
Dim rs As SqlDataReader

Try
con = New SqlConnection(S ession("ConnStr ing").ToString )
con.Open()
Catch ex As Exception
strException = "Error.aspx?Exc eption=" & ex.Message
Response.Redire ct(strException )
Return
End Try
Response.Write( "Connection String from AWPROD" &
Session("ConnSt ring").ToString )
cmd = New SqlCommand("sel ect status,GU_MsgCo unt,alt_msgcoun t from
CP_componentDet ails where comp_id=2 and Control_Type='M AG3D'", con)
rs = cmd.ExecuteRead er()

If (rs.Read) Then
CylMag3DAlert.M essage = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(2). ToString
CylMag3DGU.Mess age = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(1). ToString
Response.Write( "No of messages in MAG 3D Queue" &
rs.GetValue(1). ToString)
Else
CylMag3DAlert.M essage = "Status :Not Running or <br/>it is in
Idle state"
CylMag3DGU.Mess age = "Status :Not Running or <br/> it is in Idle
state"

End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("sel ect status,GU_MsgCo unt,alt_msgcoun t from
CP_componentDet ails where comp_id=2 and Control_Type='M AG'", con)
rs = cmd.ExecuteRead er()
If (rs.Read) Then
CylMagAlertQueu e.Message = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(2). ToString
CylMagGUQueue.M essage = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(1). ToString
Else
CylMagAlertQueu e.Message = "Status :Not Running or <br/> it is
in Idle state"
CylMagGUQueue.M essage = "Status :Not Running or <br/> it is in
Idle state"

End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("sel ect status from CP_ComponentDet ails where
Comp_Id=1 and Control_Type='M AG'", con)
rs = cmd.ExecuteRead er()
If (rs.Read) Then
magStatus = "MAG Status :" & rs.GetString(0)

End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("sel ect status from CP_ComponentDet ails where
Comp_Id=1 and Control_Type='M AG3D'", con)
rs = cmd.ExecuteRead er()
If (rs.Read) Then
mag3dStatus = "MAG3D Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()
'RectEMailConv. Message = magStatus & "<br/>" & mag3dStatus

cmd = New SqlCommand("sel ect status from CP_componentDet ails where
comp_id=3 and Control_Type='M AG3D'", con)
rs = cmd.ExecuteRead er()

If (rs.Read) Then
CylMag3DGUParse r.Message = "Status : " + rs.GetString(0)
CylMag3DAlertPa rser.Message = "Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("sel ect status from CP_componentDet ails where
comp_id=3 and Control_Type='M AG'", con)
rs = cmd.ExecuteRead er()

If (rs.Read) Then
CylMagGUParser. Message = "Status : " + rs.GetString(0)
CylMagAlertPars er.Message = "Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()
con.Close()
End Sub
Here the Session("ConnSt ring").ToString value gets different Database
connection values (there are three servers). I am able to set the correct
value in the session.
But when the SQL statement gets executed in one server I am getting always 0
value. But in other servers I get the correct information. Is there any way I
can track this problem down.
Thanks
Any help would be greatly appreciated.

John
Jul 21 '05 #1
2 1318
Get the SQL statements and try it on the DB. Could it be that the data are
not the same on one for your server ?

As a side note, ASP.NET 2.0 is AFAIK not yet licensed for production. It
should be used only for evaluation purpose...

Patrice

--

"John @ X" <Jo***@discussi ons.microsoft.c om> a écrit dans le message de
news:8F******** *************** ***********@mic rosoft.com...
Hi there,
I have been having a nightmare with one of ASP .Net 2.0 app which works fine in our development environment. WHen I move to the production server the
database is getting wacked. I am trying to establish a connection thro a XML string. Everything works fine and I am able to connect to the specific
database and make queries with that connection object. But once I move to the production server and try to connect to a specific database I am getting
screwed. It is establishing the database connection correctly in the
prodcution server but when I execute a query it returns 0 and I dont know
where I am going wrong. I am attaching herewith code snippet which is
misbehaving in the production server.

Sub getAWPRODDBValu es()
Dim cmd As New SqlCommand
Dim magStatus As String = ""
Dim mag3dStatus As String = ""
Dim strException As String = ""
Dim rs As SqlDataReader

Try
con = New SqlConnection(S ession("ConnStr ing").ToString )
con.Open()
Catch ex As Exception
strException = "Error.aspx?Exc eption=" & ex.Message
Response.Redire ct(strException )
Return
End Try
Response.Write( "Connection String from AWPROD" &
Session("ConnSt ring").ToString )
cmd = New SqlCommand("sel ect status,GU_MsgCo unt,alt_msgcoun t from
CP_componentDet ails where comp_id=2 and Control_Type='M AG3D'", con)
rs = cmd.ExecuteRead er()

If (rs.Read) Then
CylMag3DAlert.M essage = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(2). ToString
CylMag3DGU.Mess age = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(1). ToString
Response.Write( "No of messages in MAG 3D Queue" &
rs.GetValue(1). ToString)
Else
CylMag3DAlert.M essage = "Status :Not Running or <br/>it is in
Idle state"
CylMag3DGU.Mess age = "Status :Not Running or <br/> it is in Idle state"

End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("sel ect status,GU_MsgCo unt,alt_msgcoun t from
CP_componentDet ails where comp_id=2 and Control_Type='M AG'", con)
rs = cmd.ExecuteRead er()
If (rs.Read) Then
CylMagAlertQueu e.Message = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(2). ToString
CylMagGUQueue.M essage = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(1). ToString
Else
CylMagAlertQueu e.Message = "Status :Not Running or <br/> it is
in Idle state"
CylMagGUQueue.M essage = "Status :Not Running or <br/> it is in
Idle state"

End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("sel ect status from CP_ComponentDet ails where
Comp_Id=1 and Control_Type='M AG'", con)
rs = cmd.ExecuteRead er()
If (rs.Read) Then
magStatus = "MAG Status :" & rs.GetString(0)

End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("sel ect status from CP_ComponentDet ails where
Comp_Id=1 and Control_Type='M AG3D'", con)
rs = cmd.ExecuteRead er()
If (rs.Read) Then
mag3dStatus = "MAG3D Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()
'RectEMailConv. Message = magStatus & "<br/>" & mag3dStatus

cmd = New SqlCommand("sel ect status from CP_componentDet ails where
comp_id=3 and Control_Type='M AG3D'", con)
rs = cmd.ExecuteRead er()

If (rs.Read) Then
CylMag3DGUParse r.Message = "Status : " + rs.GetString(0)
CylMag3DAlertPa rser.Message = "Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("sel ect status from CP_componentDet ails where
comp_id=3 and Control_Type='M AG'", con)
rs = cmd.ExecuteRead er()

If (rs.Read) Then
CylMagGUParser. Message = "Status : " + rs.GetString(0)
CylMagAlertPars er.Message = "Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()
con.Close()
End Sub
Here the Session("ConnSt ring").ToString value gets different Database
connection values (there are three servers). I am able to set the correct
value in the session.
But when the SQL statement gets executed in one server I am getting always 0 value. But in other servers I get the correct information. Is there any way I can track this problem down.
Thanks
Any help would be greatly appreciated.

John

Jul 21 '05 #2
In addition to the other response, you can use the SQL profiler to see
the queries that are being submitted to the db. They might help narrow
down the problem.

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3799
by: Dmitry Akselrod | last post by:
Hello everyone, I have a vb.net application that wraps the TCPListener object in a class. The server connects to the local interface and establishes itself on port 9900. It then polls for pending connections every 500ms. I also have a vb6 application that uses the WinSock control at the other end of the communication tunel. I have to work with vb6 here because it uses less memory than .NET.
0
5380
by: Bob | last post by:
I have an ASP.NET web application that has been running without any problems for a while. I recently transferred the site to shared hosting and had multiple users start to use the site. The problem I'm experiencing is that when many users are hitting the site at once, occasionaly I will see errors. The 3 most common ones are: "The SqlCommand is currently busy Open, Fetching. ", "Internal Connection Fatal Error", "object reference not set to...
1
4243
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here. From the log it looks like the problem happens when 2 threads insert 1 record each in the same table and then try to aquire a NS (Next Key Share) lock on the record inserterd by the other thread. Thanks Rohit
9
2201
by: Nathan Sokalski | last post by:
I am trying to connect to a Microsoft Access Database from my ASP.NET Application. I use the following code to create my connection string: cmdSelect.Connection = New System.Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATASOURCE=" & Server.MapPath("/WebApplication1/nathansokalski_com.mdb")) Although the error does not occur until the Fill() method is called:
4
4157
by: Rahul Anand | last post by:
Getting SQL Exception when trying to implement Connection based Trasaction using SQL Helper class. I am using the follwing function to execute my stored procs: -=-=-=- ExecuteScalar(ByVal transaction As SqlTransaction, _ ByVal spName As String, _ ByVal ParamArray parameterValues() As Object)
2
3563
by: John | last post by:
Hi I was working fine with create user wizard and the default membership provider. I have now customised the membership provider as per attached web.config. The create user wizard picks up the custom membership provider fine and removes the security question/answer fields as designated in the custom provider. The problem is that when I try to create a new user in the create user wizard by entering the info and pressing the 'create...
7
6937
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports the status of the machines. Upon we follow the .NET object lifetime recommendations the application is constantly consuming more memory! The problem is on the ManagementObjectSearch, upon we Dispose the object it seems that is not releasing the...
2
9760
by: Dennis | last post by:
I'm getting the following problem occasionally...the application will work perfectly well for a period of time and then this pops up. I have tried turning off the default proxy in the web.config which I had seen on other posts but that did not solve the problem. Any assistance or ideas would be appreciated Thanks
12
2266
by: Light | last post by:
Hi all, I posted this question in the sqlserver.newusers group but I am not getting any response there so I am going to try it on the fine folks here:). I inherited some legacy ASP codes in my office. The original code's backend is using the SQL Server 2000 and I am testing to use it on the Express edition. And I run into the following problem.
5
3401
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open left, I always see that there are 2 connections open and in "ESTABLISHED" state. Here is the piece of code that I'm using, please tell where I'm doing it wrong. Since this class is being used at many placed in my actual web based application that...
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9090
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6813
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.