【问题标题】:Inserting data into database from HTML table generated at client side [closed]从客户端生成的 HTML 表中将数据插入数据库[关闭]
【发布时间】:2016-01-23 06:24:38
【问题描述】:

我使用从 Excel 文件中复制数据并将其粘贴到文本框中并运行 jQuery 来解析它,生成了一个 HTML 表格。

为了实现这一点,我遵循了这个问题- Copy/Paste from Excel to a web page

现在下一个要求是我需要将此 HTML 表中的数据插入到数据库表中。

如何在 ASP.NET Web 表单中做到这一点?

【问题讨论】:

    标签: c# html asp.net database


    【解决方案1】:

    编写一个接受数据的 ASP 页面,解析 ',andtags into rows of values and then do a SQLINSERT` 语句。

    但为什么首先将其编码到 ',and` 字段中呢?为什么不粘贴数据并将其提交到您的服务器,然后在服务器上进行解析?

    var rows = data.split("\n");
    
    for(var y in rows) {
        var cells = rows[y].split("\t");
    
        // call sql 'INSERT' supplying cell[0]  ... cell[n]
        // as the arguments values of  the INSERT         
    }
    

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-01
      • 1970-01-01
      • 2012-08-21
      • 1970-01-01
      • 2013-07-02
      • 2013-03-29
      • 2017-11-01
      • 1970-01-01
      相关资源
      最近更新 更多