Re: How can I retrieve data from SQLServer with a specify network

From: Mike Labosh (mlabosh_at_hotmail.com)
Date: 10/08/04


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?"
>>
>>
>> 


Relevant Pages

  • Re: "Routing and Remote Access" doesnt allot LAN connect to Internet
    ... Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on ... > I have a Server with Windows Server 2003 that is connected to Internet by ... > mean of a DSL connection. ... > second NIC of this server is connected to a LAN. ...
    (microsoft.public.win2000.ras_routing)
  • RE: microsoft fax e-mail routing of incoming faxes
    ... But I have been using the SBS wizards to change the users and all the ... we use Configure Fax wizard to set the incoming fax routing ... I suggest you to re-run the Configure Fax wizard (Server ...
    (microsoft.public.windows.server.sbs)
  • RE: Inbound Fax Routing via e-Mail failure
    ... Let's re-run CEICW to reset the network configuration. ... How to configure Internet access in Windows Small Business Server 2003 ... Check the SMTP Server Configuration. ... E-mail incoming routing method" ...
    (microsoft.public.windows.server.sbs)
  • Re: Mail system dll is invalid.
    ... But fax routing still is't working. ... I've installed to test before our server is moved. ... Under Standard Management, click "To Do List". ... Can you see the SMTP banner? ...
    (microsoft.public.windows.server.sbs)
  • Re: Fax server failing to route to email. (paging "Brandy")
    ... Jerz ... > The mail system dll error is to be expected since outlook or outlook ... > on the smtp virtual server so once I rechecked the anonymous access box ... > so it would reach it's destination using the same routing method that was ...
    (microsoft.public.windows.server.sbs)