473,473 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
Create 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 getAWPRODDBValues()
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(Session("ConnString").ToString)
con.Open()
Catch ex As Exception
strException = "Error.aspx?Exception=" & ex.Message
Response.Redirect(strException)
Return
End Try
Response.Write("Connection String from AWPROD" &
Session("ConnString").ToString)
cmd = New SqlCommand("select status,GU_MsgCount,alt_msgcount from
CP_componentDetails where comp_id=2 and Control_Type='MAG3D'", con)
rs = cmd.ExecuteReader()

If (rs.Read) Then
CylMag3DAlert.Message = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(2).ToString
CylMag3DGU.Message = "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.Message = "Status :Not Running or <br/>it is in
Idle state"
CylMag3DGU.Message = "Status :Not Running or <br/> it is in Idle
state"

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

cmd = New SqlCommand("select status,GU_MsgCount,alt_msgcount from
CP_componentDetails where comp_id=2 and Control_Type='MAG'", con)
rs = cmd.ExecuteReader()
If (rs.Read) Then
CylMagAlertQueue.Message = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(2).ToString
CylMagGUQueue.Message = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(1).ToString
Else
CylMagAlertQueue.Message = "Status :Not Running or <br/> it is
in Idle state"
CylMagGUQueue.Message = "Status :Not Running or <br/> it is in
Idle state"

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

cmd = New SqlCommand("select status from CP_ComponentDetails where
Comp_Id=1 and Control_Type='MAG'", con)
rs = cmd.ExecuteReader()
If (rs.Read) Then
magStatus = "MAG Status :" & rs.GetString(0)

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

cmd = New SqlCommand("select status from CP_ComponentDetails where
Comp_Id=1 and Control_Type='MAG3D'", con)
rs = cmd.ExecuteReader()
If (rs.Read) Then
mag3dStatus = "MAG3D Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()
'RectEMailConv.Message = magStatus & "<br/>" & mag3dStatus

cmd = New SqlCommand("select status from CP_componentDetails where
comp_id=3 and Control_Type='MAG3D'", con)
rs = cmd.ExecuteReader()

If (rs.Read) Then
CylMag3DGUParser.Message = "Status : " + rs.GetString(0)
CylMag3DAlertParser.Message = "Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("select status from CP_componentDetails where
comp_id=3 and Control_Type='MAG'", con)
rs = cmd.ExecuteReader()

If (rs.Read) Then
CylMagGUParser.Message = "Status : " + rs.GetString(0)
CylMagAlertParser.Message = "Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()
con.Close()
End Sub
Here the Session("ConnString").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 1300
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***@discussions.microsoft.com> a écrit dans le message de
news:8F**********************************@microsof t.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 getAWPRODDBValues()
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(Session("ConnString").ToString)
con.Open()
Catch ex As Exception
strException = "Error.aspx?Exception=" & ex.Message
Response.Redirect(strException)
Return
End Try
Response.Write("Connection String from AWPROD" &
Session("ConnString").ToString)
cmd = New SqlCommand("select status,GU_MsgCount,alt_msgcount from
CP_componentDetails where comp_id=2 and Control_Type='MAG3D'", con)
rs = cmd.ExecuteReader()

If (rs.Read) Then
CylMag3DAlert.Message = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(2).ToString
CylMag3DGU.Message = "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.Message = "Status :Not Running or <br/>it is in
Idle state"
CylMag3DGU.Message = "Status :Not Running or <br/> it is in Idle state"

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

cmd = New SqlCommand("select status,GU_MsgCount,alt_msgcount from
CP_componentDetails where comp_id=2 and Control_Type='MAG'", con)
rs = cmd.ExecuteReader()
If (rs.Read) Then
CylMagAlertQueue.Message = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(2).ToString
CylMagGUQueue.Message = "Status :" & rs.GetString(0) &
"<br/>Messages : " + rs.GetValue(1).ToString
Else
CylMagAlertQueue.Message = "Status :Not Running or <br/> it is
in Idle state"
CylMagGUQueue.Message = "Status :Not Running or <br/> it is in
Idle state"

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

cmd = New SqlCommand("select status from CP_ComponentDetails where
Comp_Id=1 and Control_Type='MAG'", con)
rs = cmd.ExecuteReader()
If (rs.Read) Then
magStatus = "MAG Status :" & rs.GetString(0)

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

cmd = New SqlCommand("select status from CP_ComponentDetails where
Comp_Id=1 and Control_Type='MAG3D'", con)
rs = cmd.ExecuteReader()
If (rs.Read) Then
mag3dStatus = "MAG3D Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()
'RectEMailConv.Message = magStatus & "<br/>" & mag3dStatus

cmd = New SqlCommand("select status from CP_componentDetails where
comp_id=3 and Control_Type='MAG3D'", con)
rs = cmd.ExecuteReader()

If (rs.Read) Then
CylMag3DGUParser.Message = "Status : " + rs.GetString(0)
CylMag3DAlertParser.Message = "Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()

cmd = New SqlCommand("select status from CP_componentDetails where
comp_id=3 and Control_Type='MAG'", con)
rs = cmd.ExecuteReader()

If (rs.Read) Then
CylMagGUParser.Message = "Status : " + rs.GetString(0)
CylMagAlertParser.Message = "Status :" & rs.GetString(0)
End If
cmd.Dispose()
rs.Close()
con.Close()
End Sub
Here the Session("ConnString").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
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...
0
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...
1
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....
9
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...
4
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...
2
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...
7
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...
2
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...
12
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...
5
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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,...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.