473,386 Members | 1,962 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,386 software developers and data experts.

How to pass an IP address in connection string?

I have a database that is stored on a remote machine.
In my application i have used connection string with
IP address of that remote machine. Now, the problem is
every time the remote machine is turned on it has a new
IP address. Is there any way that i can get that newly
generated IP address stored in connection string automatically
every time i try to connect to database.

Here's my connection string :
(Toggle Plain Text)
Expand|Select|Wrap|Line Numbers
  1. Data Source=xxx.xxx.xxx.xxx,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
  2.  
NOTE : Its not a web application.
Feb 24 '11 #1
1 3672
why don't u try getting IPADDRESS of remote machine into ur application using the remote machines HOSTNAME...

using System.Net;

string reotemachinename = "ur_reotemachinename";
IPHostEntry addresslist = Dns.GetHostByName(reotemachinename );

foreach (IPAddress theaddress in addresslist.AddressList)
{
MessageBox.Show(theaddress.ToString());
}
Mar 4 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Gram | last post by:
Hello, Can anyone point me to a connection string for ASP to connect to an MS Access database using a username and password? Thanks in advance. Gram
6
by: Paul Robinson | last post by:
I am developing a website in ASP that connects to a Sybase database. However, when I try to open a connection to the database the page will not load. The script does not timeout, nor the...
1
by: timandsuzi36 | last post by:
Here's the issue. Appreciate any help any Access gurus can offer. I have a .NET WinForms application that needs to launch a Access DB application used for generating Access Reports. That part...
4
by: Jeff | last post by:
I have a main project which references several DLLs. Each DLL will access the same database as the main project. I'm storing the connection string within the main project's "web.config" file, so...
19
by: Jaime Stuardo | last post by:
Hi all.. I have created a business logic component that is used from my ASP.NET webform. It works, but connection string to the database is hard coded, as in this method : public DataSet...
6
by: Bala Nagarajan | last post by:
Hello, I am using Oracle 9i in my application and facing a problem with the connection string. In the datasource attribute of the connection string i had to specify an entry in "tnsnames.ora"...
1
by: anonymike | last post by:
Hi, I'm having a problem that I've been working with for the last week, I'm not having any luck, I'm hoping someone can help me. Anything would be appreciated. I have a setup where we...
2
by: John | last post by:
Hi I am manually able to create a connection to my db in the vs2005 ide using Tools->Connect to Database. In the connection I see 'Data Source=MYSERVER;Initial Catalog=aspnetdb;Integrated...
13
by: Jennifer.Berube | last post by:
well I'm not sure how to go about making my SQL connection string... The code below is what I need to replace with my SQL connection...I just don't know if that code is for DSN or access... I...
1
by: Dean Slindee | last post by:
VS2008, .NetFramework 3.5 SP1: I have built a LINQ data access layer project. When the LINQ data context was built over an existing SQL2005 database, the connection string for that database was...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.