Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Dear all,

I am working on a web application. I want to connect to the database available on remote location and fetch that information on the server side. I have one page at server side on which I can get that data on page load event. How can I get that data available on the remote location?

Any kind of link, suggestion and specially expert advice would be highly appreciated.

Thanks & Regards,
Balkrishna Raut
Posted
Updated 10-Mar-11 2:45am
v2
Comments
rajeshmulchandani 10-Mar-11 8:46am    
do you want to know the connection string for a remote database?
meBalkrishna 10-Mar-11 8:51am    
no i mean how to get the data available in the database at remote location like on a different local host, and it has some fields so how can retrieve this data.
rajeshmulchandani 10-Mar-11 8:54am    
Do you want to fetch data from a remote application with its own database?
Piccadilly Yum Yum 10-Mar-11 10:00am    
You cannot access page.load on server from remote location ... you can in your page.load transmit your data via http or whatelse

XML
If the remote page is already displaying the data, you can examine the html content of the remote page. Now identify the html elements that are around the content.  For example, the records maybe contained in a <div> or <table> element.

With AJAX, you can download the html from this remote page. The next step will be to parse the html content to extract the data that you are looking for.

I hope it helps
 
Share this answer
 
You may want a webpage within your web application that writes the data in XML format :
Create a new WebForm

In the Load event put the following code :

C#
string responseXml = CreateXmlFromDatabase();
Response.ContentType = "text/xml";
Response.Write(responseXml);
Response.End();


And ofcourse create a function CreateXmlFromDatabase() which returns the data you want to pass as a string :

C#
private string CreateXmlFromDatabase()
{
  StringBuilder sbXml = new StringBuilder("");
  sbXml.Append("<mydata>");

  // Add more XML here that contains data from your database

  sbXml.Append("</mydata>");
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900