本文介绍了将HTML表数据填充到表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have the table in the below format.
FirstName姓氏
Jill Smith
Eve Jackson
此外,我还有表格更新名字&姓。这是表格代码。
FirstName Last Name
Jill Smith
Eve Jackson
Also i have Form for updating the firstname & lastname. This is the form code.
<!DOCTYPE html>
<html>
<body>
<form border="1">
<tr>
<td><label >FirtsName</label></td>
<td><input type="text" id="firstname" class="medium"></td>
</tr>
<tr>
<td><label >LastName</label></td>
<td><input type="text" id="lastname" class="medium"></td>
</tr>
</form>
</body>
</html>
How to send the table data to a form using jquery or javascript. Any help will be much appreciated!
Thanks & regards Karthick
推荐答案
SqlConnection con = new SqlConnection("YourConnectionStringHere");
con.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM Table1", con);
SqlDataReader sdr = cmd.ExecuteReader();
while(sdr.Read())
{
TextBox1.Text = Convert.ToString(sdr["FirstName"]);
TextBox2.Text = Convert.ToString(sdr["LastName"]);
}
//Releasing the objects
sdr.Dispose();
cmd.Dispose();
con.Close();
--Amit
--Amit
这篇关于将HTML表数据填充到表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!