B
Bill in Kansas City
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.closeConnection)
' 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
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.closeConnection)
' 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