使用C sharp将HTML表格数据转储到数据库中 [英] Dumping HTML table data in database using C sharp

查看:81
本文介绍了使用C sharp将HTML表格数据转储到数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


i真的需要帮助我坚持我的最后一年项目。

主要问题是我想从这个链接获取数据:

< a href =http://www.ise.com.pk/TradeScreen.asp> http://www.ise.com.pk/TradeScreen.asp

和转储在数据库....

但如果你检查课程代码,表中没有CLASS。

所以我不能使用下面的代码来获取数据:

 其中 d.Name ==   table&& d.Attributes [  class]。值==    Clase名称 



所以,请帮助我如何使用c获取数据锐利并将其转储到我的数据库中



代码块固定和clickety [/ edit]

解决方案

你必须使用jquery和

循环遍历所有<表>< TBODY>和<表格中的tr> ..

获取数据..

将数据存储在变量中

从c#
读取数据
将其转储到您的数据库中。



这是一个怎么回事



 <   table  >  
< tbody >
< tr > ;
< td >
Item1
< / td >
< / tr >
< tr >
< td >
价值
< / td >
< / tr >
< / tbody >
< / table >





这里是jquery





 

' table> tbody> tr')。each( function (){... code ...});





你可以在上面的函数中使用td:first-child或td:nth-​​child(2)来选择< td>的



希望这会有所帮助..



格式和代码块已修复[/ edit]


Hi i really need help i m stuck in my final year project.
The main problem is i want to get the data from this link:
http://www.ise.com.pk/TradeScreen.asp
and Dump in database....
but if u check the course code there is no CLASS in the table.
so i cant use this below code to fetch the data:

where d.Name == "table" && d.Attributes["class"].Value == "Clase name"


So please help me out how can i get that data using c sharp and dump it in my database

[edit]Code block fixed and clickety[/edit]

解决方案

You will have to use jquery and
loop through all < table>< tbody> and < tr>s inside that table..
fetch the data..
store data in a variables
read it from c#
dump it in your database.

here is an how it goes

<table>
    <tbody>
        <tr>
            <td>
                Item1
            </td>
        </tr>
        <tr>
            <td>
                Value
            </td>
        </tr>
    </tbody>
</table>



here is the jquery



('table > tbody > tr').each(function() {...code...});



you can use td:first-child or td:nth-child(2) inside the abovefunction to select the < td>'s

hope this will help..

[edit]Format and Code block fixed[/edit]


这篇关于使用C sharp将HTML表格数据转储到数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆