sda.Update批量更新数据

老方法了,重新做个记录。

string connStr = ConfigurationManager.ConnectionStrings["constring"].ToString();
SqlDataAdapter sda = null;
DataTable dt = Common.ListToDataTable<CityInfoWAP>(lst.OrderBy(o => o.firstLetter).ToList<CityInfoWAP>());
using (SqlConnection conn = new SqlConnection(connStr))
{
	conn.Open();
	string sql = "SELECT firstLetter,code,spell,spellShort,name FROM EnterpriseCitysFlightWAP";
	sda = new SqlDataAdapter(sql, conn);
	SqlCommandBuilder sqlcb = new SqlCommandBuilder(sda);
	sda.Update(dt);
	WebHelper.LogHelper.WriteLog("数据插入成功!");
}

 另见:http://skybirdzw.blog.163.com/blog/static/7257062620111151075017/

原文地址:https://www.cnblogs.com/zhaow/p/8259906.html