473,782 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ 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 connectionStrin g As String
connectionStrin g = ConfigurationSe ttings.AppSetti ngs("CxnStr")
' now we have a valid connection string
' Network Library=DBMSSOC N;Data Source=aaa.bbb. ccc.ddd,eeee;In itial
Catalog=myDB;Us er Id=myUser;Passw ord=myPassword; application name=MyApp;

Dim sSQL As String = "exec
spVehicle_GetVe hicleInformatio nByKeyfield " & Request("keyFie ld") & ",
'" & Request("status ") & "'"
' which translates to exec
spVehicle_GetVe hicleInformatio nByKeyfield 12345, 'Used', which works

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

objDr =
cmd.ExecuteRead er(system.data. commandbehavior .closeConnectio n)
' err.number = 0

if objDr.read() then
' this is where we went yesterday...
makedescription .text = objdr("makedesc ription")
modeldescriptio n.text = objdr("modeldes cription")
modelyear.text = objdr("modelyea r")
stocknumber.tex t = objdr("stocknum ber")
serialnumber.te xt = objdr("serialnu mber")
listprice.text = objdr("listpric e")
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 1119
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******@hotma il.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 connectionStrin g As String
connectionStrin g = ConfigurationSe ttings.AppSetti ngs("CxnStr")
' now we have a valid connection string
' Network Library=DBMSSOC N;Data Source=aaa.bbb. ccc.ddd,eeee;In itial
Catalog=myDB;U ser Id=myUser;Passw ord=myPassword; application name=MyApp;

Dim sSQL As String = "exec
spVehicle_GetV ehicleInformati onByKeyfield " & Request("keyFie ld") & ",
'" & Request("status ") & "'"
' which translates to exec
spVehicle_GetV ehicleInformati onByKeyfield 12345, 'Used', which works

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

objDr =
cmd.ExecuteRea der(system.data .commandbehavio r.closeConnecti on)
' err.number = 0

if objDr.read() then
' this is where we went yesterday...
makedescription .text = objdr("makedesc ription")
modeldescriptio n.text = objdr("modeldes cription")
modelyear.text = objdr("modelyea r")
stocknumber.tex t = objdr("stocknum ber")
serialnumber.te xt = objdr("serialnu mber")
listprice.text = objdr("listpric e")
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
2185
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 I am doing is quering the db for all the headers for a certain group and then going through them to find all the parts of each post. I only want ones that are complete. Meaning all segments for that one file posted are there. using System;
13
4968
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 please tell me how do i go about it?
11
3781
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 particular that is emitting packets that I need to monitor. Is there a function in C (maybe using winAPI) that will return the list of com ports? Another question I have is whether I am using CreateFile correctly. For debugging purposes you can see I...
1
2321
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 over the while .....hasMoreItems. When I set the hasMoreItems to false it executes it. There are no syntax errors and it runs completely, it just doesn't give me the info I need. Thanks in advance! package gps; import javax.comm.*;...
0
10313
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...
1
10080
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
9944
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6735
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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 we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.