The data was recently done in a project that encountered batch update data, the code is as follows:
An example of an update:
<%@ Page language= "C #" debug= "true"%>
<%@ Import namespace= "System.Data"%>
<%@ Import namespace= "System.Data.SqlClient"%>
<script runat= "Server" >
void Page_Load (object sender, System.EventArgs e) {
SqlConnection conn = new SqlConnection ("server=localhost;uid=sa;pwd=kingapex;database=tourmsg");
SqlDataAdapter da = new SqlDataAdapter ();
SqlCommand cmd = new SqlCommand ("Select top 2 Id,groupnumber as Groupnumber1 from [GROUPTB]", conn);
DataSet ds = new DataSet ();
Conn. Open ();
Da. SelectCommand = cmd;
Da. Fill (ds, "GROUPTB");
for (int i=0;i<ds. tables["GROUPTB"]. rows.count;i++)
{
for (int i=0;i<ds. tables["GROUPTB"]. rows.count;i++)
{
Ds. tables["GROUPTB"]. Rows.beginedit ();
Ds. tables["GROUPTB"]. ROWS[1] = "WANGFENGRR";
Ds. tables["GROUPTB"]. Rows.endedit ();
}
String updatecmd = "Update grouptb set groupnumber = @groupnumber Where id= @id";
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service