sql不替换uid的更新数据语句
生活随笔
收集整理的這篇文章主要介紹了
sql不替换uid的更新数据语句
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
1.覆蓋數據時uid主鍵不修改的語句
on duplicate key update
private void ImportMyData(string name,string year,List<MyInfoDetail> listMyInfo) {IDbShell shell_w = Common.GetIDbShell(ActionType.Read); try { shell_w.BeginTransaction(); if(listMyInfo!=NULL &&listMyInfo.Count>0) { foreach (var exeein listMyInfo) { string Uid=exee.ex_id+exee.exam_no+exee.es_num; string sql = @"insert into `userinfo` VALUES(@0,@1,@2,@3,@4,@5,@6,'A',@7,@8,@9,@10,@11,@12,@13,@14,@15,@16,now(),now())on duplicate key update id=@1,num=@2,no=@3,name=@4,cert_id=@5,cert_no=@6,code=@7,lxdm=@8,cldm=@9,ssdm=@10, ss=@11, cl=@12,bj=@13,mc=@14,qk=@15,sj=@16,update_time=now(),create_time=now();"; shell_w.ExecuteQueryDataSet(sql, Uid, Id, num, no, name, cert_id, cert_no,code, exee.wglxdm, cldm, ssdm, ss, cl, bj,mc, qk, sj); } } } shell_w.Commit(); } catch(Exception ex) {shell_w.Rollback();Common.SaveErrorLog(ex.Message);shell_w.EndTransaction(); }finally{shell_w.Close();shell_w.Dispose();} }?
轉載于:https://my.oschina.net/u/3544533/blog/1788724
總結
以上是生活随笔為你收集整理的sql不替换uid的更新数据语句的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CentOS8英伟达显卡驱动的安装和卸载
- 下一篇: 物联网正在蚕食嵌入式系统市场