473,473 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Could a change of SQL ports break a data reader?

Can a change of SQL port affect a SQLDataReader's ability to pull data?
The code that follows was working just fine yesterday, and the only
thing that's changed between then and now is the SQL port. The
connection string is updated with the port - aaa.bbb.ccc.ddd,eeee -
where eeee is the new port number. The connection comes in just fine,
state = 1 (though yesterday it was "Open", weird), and the query runs
without error in Query Analyzer.

Dim connectionString As String
connectionString = ConfigurationSettings.AppSettings("CxnStr")
' now we have a valid connection string
' Network Library=DBMSSOCN;Data Source=aaa.bbb.ccc.ddd,eeee;Initial
Catalog=myDB;User Id=myUser;Password=myPassword;application name=MyApp;

Dim sSQL As String = "exec
spVehicle_GetVehicleInformationByKeyfield " & Request("keyField") & ",
'" & Request("status") & "'"
' which translates to exec
spVehicle_GetVehicleInformationByKeyfield 12345, 'Used', which works

Dim conn As New SqlConnection(connectionString)
Dim cmd As New SqlCommand(sSQL, conn)
Dim objDr As SqlDataReader
conn.Open()
' state = 1

objDr =
cmd.ExecuteReader(system.data.commandbehavior.clos eConnection)
' err.number = 0

if objDr.read() then
' this is where we went yesterday...
makedescription.text = objdr("makedescription")
modeldescription.text = objdr("modeldescription")
modelyear.text = objdr("modelyear")
stocknumber.text = objdr("stocknumber")
serialnumber.text = objdr("serialnumber")
listprice.text = objdr("listprice")
else
' this is where we go now
response.write("Unable to write vehicle information<BR>")
end if

The obvious answer is flip the port back to default and see if my code
starts working, but I'd like to avoid that if I can. To do that, I'd
have to disconnect all of our users and change the connection strings
in five different applications; not a good thing. I'd like to find an
answer like "Oh, all you have to do is specify the spoo of the fleem,
and you're all set..."

Thanks in advance for any insights.

- Bill in KC

Nov 19 '05 #1
1 1103
Hi Bill:

What happens now? Is there an exception? What's the error message? Are
you sure the query is still returning rows? Can you use SQL Profiler
to catch the statement that gets executed, paste it into query
analyzer and see if any rows come back?

Just some troubleshooting tips,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 16 Jun 2005 08:03:45 -0700, "Bill in Kansas City"
<se******@hotmail.com> wrote:
Can a change of SQL port affect a SQLDataReader's ability to pull data?
The code that follows was working just fine yesterday, and the only
thing that's changed between then and now is the SQL port. The
connection string is updated with the port - aaa.bbb.ccc.ddd,eeee -
where eeee is the new port number. The connection comes in just fine,
state = 1 (though yesterday it was "Open", weird), and the query runs
without error in Query Analyzer.

Dim connectionString As String
connectionString = ConfigurationSettings.AppSettings("CxnStr")
' now we have a valid connection string
' Network Library=DBMSSOCN;Data Source=aaa.bbb.ccc.ddd,eeee;Initial
Catalog=myDB;User Id=myUser;Password=myPassword;application name=MyApp;

Dim sSQL As String = "exec
spVehicle_GetVehicleInformationByKeyfield " & Request("keyField") & ",
'" & Request("status") & "'"
' which translates to exec
spVehicle_GetVehicleInformationByKeyfield 12345, 'Used', which works

Dim conn As New SqlConnection(connectionString)
Dim cmd As New SqlCommand(sSQL, conn)
Dim objDr As SqlDataReader
conn.Open()
' state = 1

objDr =
cmd.ExecuteReader(system.data.commandbehavior.clo seConnection)
' err.number = 0

if objDr.read() then
' this is where we went yesterday...
makedescription.text = objdr("makedescription")
modeldescription.text = objdr("modeldescription")
modelyear.text = objdr("modelyear")
stocknumber.text = objdr("stocknumber")
serialnumber.text = objdr("serialnumber")
listprice.text = objdr("listprice")
else
' this is where we go now
response.write("Unable to write vehicle information<BR>")
end if

The obvious answer is flip the port back to default and see if my code
starts working, but I'd like to avoid that if I can. To do that, I'd
have to disconnect all of our users and change the connection strings
in five different applications; not a good thing. I'd like to find an
answer like "Oh, all you have to do is specify the spoo of the fleem,
and you're all set..."

Thanks in advance for any insights.

- Bill in KC


Nov 19 '05 #2

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

Similar topics

10
by: Extremest | last post by:
I know there are ways to make this a lot faster. Any newsreader does this in seconds. I don't know how they do it and I am very new to c#. If anyone knows a faster way please let me know. All...
13
by: sonald | last post by:
Hi, Can anybody tell me how to change the text delimiter in FastCSV Parser ? By default the text delimiter is double quotes(") I want to change it to anything else... say a pipe (|).. can anyone...
11
by: kudruu | last post by:
Hi, I am trying to find a way to populate a list of active Com ports on a computer. There may be around 30 on one computer and all connected to different Buses but I am looking for one in...
1
by: Jollywg | last post by:
I'm running a small program that should list all of the comm ports that are available on the computer. The only problem is that nothing is recognized. I've stepped through the program and it jumps...
0
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,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.