3 Replies - 4688 Views - Last Post: 21 April 2010 - 01:43 PM Rate Topic: -----

#1 djlakshmi  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 22-March 10

save web page content on to a database

Posted 19 April 2010 - 10:24 PM

hello all,

i want to save the web page content into a database. how can i fetch data from that website and save into a sql database. im using c# as front end.

need help.

expecting reply soon since it needed for my project.

thanks.
Is This A Good Question/Topic? 0
  • +

Replies To: save web page content on to a database

#2 Crunch  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 139
  • View blog
  • Posts: 1,222
  • Joined: 28-July 09

Re: save web page content on to a database

Posted 20 April 2010 - 06:55 AM

What data are you expecting to fetch.

well what ever the data you are trying to fetch say

string s;

and s contains the fetched data

you can insert the string s into a text field in the database.
Was This Post Helpful? 0
  • +
  • -

#3 djlakshmi  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 22-March 10

Re: save web page content on to a database

Posted 21 April 2010 - 03:12 AM

View PostAu-Z-C, on 20 April 2010 - 05:55 AM, said:

What data are you expecting to fetch.

well what ever the data you are trying to fetch say

string s;

and s contains the fetched data

you can insert the string s into a text field in the database.


i want to fetch the table of contents. lets say if there is a web page which has the table i want to save that whole table contents on to sql server database.. how can i do it programmatically.

help me.

thanks
Was This Post Helpful? 0
  • +
  • -

#4 Paul-  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 61
  • View blog
  • Posts: 260
  • Joined: 11-December 09

Re: save web page content on to a database

Posted 21 April 2010 - 01:43 PM

There are 2 steps involved:
  • 1. Parse the HTML from the web page, extract the data you need
  • 2. Load the data into the database


The details will depend on the particulars of your assignment. For example, is the structure of the HTML page given to you, or do you have to design it? Same for the database: does the schema exist, or do you have to create it?

For #1, you could write your own parser using regular expressions, or you could get access to specific fields through the DOM (document object model).

For #2, you need to create a SqlConnection and use a SqlCommand to send SQL insert statements to the database. This functionality is found in System.Data.SqlClient.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1