473,225 Members | 787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,225 software developers and data experts.

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 1099
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
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.