Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 Access
Dear all,
 
I have web pages with tabel formate data how i can extract the data to database using c#.net windows application. Please help me.
Posted 14-Feb-13 1:19am
Edited 14-Feb-13 17:47pm
v2
Comments
   
Do you want to extract a html table data into a database access file?
Member 7993229 at 14-Feb-13 7:54am
   
Yes.
   
Is your code that builds the html page or the table is part of another page?
Member 7993229 at 14-Feb-13 22:48pm
   
i dont have any code for extracting data from HTML page. Please let me know the code.
   
Solution 2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Save the data using ADO.NET as per your table structure, e.g: row wise.
 
These will help:
MSDN: ADO.NET[^]
MSDN: Accessing Data with ADO.NET[^]
Simple ADO.NET Database Read, Insert, Update and Delete using C#.[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I recommend you the "Html Agility Pack".
 
You can found it in here.
 
Some example how to use it here.
 
Sample code:
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(@"<html><body><p><table id=""foo""><tr><th>hello</th></tr><tr><td>world</td></tr></table></body></html>");
foreach (HtmlNode table in doc.DocumentNode.SelectNodes("//table")) {
    Console.WriteLine("Found: " + table.Id);
    foreach (HtmlNode row in table.SelectNodes("tr")) {
        Console.WriteLine("row");
        foreach (HtmlNode cell in row.SelectNodes("th|td")) {
            Console.WriteLine("cell: " + cell.InnerText);
        }
    }
}
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,192
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 15 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100