[英]How can I transfer html table data to Jquery script in a way that I can save it in the sql database?
I want to get table row data in the below html code into jquery like a data table in C#, so I can save it in SQL DB. 我想将下面的html代码中的表行数据像c#中的数据表一样放入jquery中,因此可以将其保存在SQL DB中。
How can i do this? 我怎样才能做到这一点?
<table class="table table-bordered" id="table_GemList">
<thead>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</thead>
<tbody id="GemListBody">
<tr>
<td>Oval</td>
<td>Red</td>
<td>2.23</td>
<td><span class="glyphicon glyphicon-trash"></span></td>
</tr>
<tr>
<td>Oval</td>
<td>Red</td>
<td>2.23</td>
<td><spanclass="glyphicon glyphicon-trash"></span></td>
</tr>
</tbody>
</table>
<tr>
s & <td>
s via. 通过<tr>
和<td>
遍历表。 jQuery and create a JSON array with the values. jQuery并使用值创建一个JSON数组。 DataTable
. 在服务器上:将数组转换为DataTable
。 SqlBulkCopy.WriteToServer
使用SqlBulkCopy.WriteToServer
将数据表直接保存到SQL数据库 To save or insert data into database you can use postback
into the server (which will refresh the page) or, using AJAX you can provide the functionality without refreshing the browser. 要将数据保存或插入数据库中,可以使用postback
到服务器(这将刷新页面),也可以使用AJAX提供功能而无需刷新浏览器。 JQuery Ajax provides you an easier option to easily integrate Ajax functionality in web applications. JQuery Ajax为您提供了一个更简单的选项,可以轻松地将Ajax功能集成到Web应用程序中。 Check this article may helpful for you : How to Save or Insert Data into SQL Server Databse using JQuery AJAX in ASP.Net C# 检查本文可能对您有所帮助: 如何在ASP.Net C#中使用JQuery AJAX将数据保存或插入到SQL Server Databse中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.