Re: How can I retrieve data from SQLServer with a specify network
From: Mike Labosh (mlabosh_at_hotmail.com)
Date: 10/08/04
- Next message: Angel Saenz-Badillos[MS]: "Re: Using Begin (Async call) with ORACLE"
- Previous message: Mary Chipman: "Re: dbo. in vs generated code for stored procedures."
- In reply to: Thana N.: "Re: How can I retrieve data from SQLServer with a specify network"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 8 Oct 2004 14:26:50 -0400
> Sorry for my uncleared information. And yes there is no NIC issue if
> routing
> is persisted. But my program have to run on an unstable network such as
> dial-up network. So retrieving data from database from dial-up network is
> unpredictable (sometimes routing table is wrong or lost). That's why I
> want
> to know how to programming a program to route and/or check routing before
> sending query to database.
AHH! I get it now. In your connection string, the Data Source value is the
server you are going to connect to. This can be a hostname, such as
dbserver, a fully qualified DNS name, such as
dbserver.intranet.mycompany.com, or an IP address.
Typically, the IP address of the database server will not change, so you
don't need check the routing table. Just attempt a connection to the
database server. It will either be able to connect, or it won't:
Public Function CanIConnect() As Boolean
Dim cnstr As String = "my connection string"
Dim cn As New SqlConnection(cnstr)
Try
cn.Open()
Catch exc As Exception
Return False
End Try
cn.Close()
Return True
End Function
-- Peace & happy computing, Mike Labosh, MCSD "It's 4:30 am. Do you know where your stack pointer is?" "Thana N." <ThanaN@discussions.microsoft.com> wrote in message news:B647EF60-4956-4E78-8604-C2E73EE549B8@microsoft.com... > > Thanks for your advise. > Thana N. > > "Mike Labosh" wrote: > >> > The NIC is irrelevant. If the port is open (1344 or 1345) and not >> > blocked >> > by a firewall, even if it is on a different network segment, whichever >> > nick is connected to the server will transmit/receive. In other words, >> > beyond making sure you have the port set, there's nothing more to do in >> > terms of ".Net programming". >> >> Using the correct server name in the SqlConnection helps, too. :) >> >> Dim cn1 As New SqlConnection(cnStringForServer1) >> Dim cn2 As New SqlConnection(cnStringForServer2) >> >> -- >> Peace & happy computing, >> >> Mike Labosh, MCSD >> >> "It's 4:30 am. Do you know where your stack pointer is?" >> >> >>
- Next message: Angel Saenz-Badillos[MS]: "Re: Using Begin (Async call) with ORACLE"
- Previous message: Mary Chipman: "Re: dbo. in vs generated code for stored procedures."
- In reply to: Thana N.: "Re: How can I retrieve data from SQLServer with a specify network"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|