关于List<String>的使用日记

中间过程不写了,直接记录下代码给个记忆:

List<string> mysqls = new List<string>();
            string sqlstring;
            DataBase db = new DataBase();
            for (int i = 0; i < employyAttRecordDataGridView.Rows.Count; i++)
            {
                sqlstring="update employyAttRecord set ";
                sqlstring += "worktime=" + employyAttRecordDataGridView.Rows[i].Cells["WorkTimeCol"].Value.ToString();
                sqlstring += ",otm=" + employyAttRecordDataGridView.Rows[i].Cells["OTmCol"].Value.ToString();
                if (employyAttRecordDataGridView.Rows[i].Cells["Att1Col"].Value.ToString() != string.Empty) sqlstring += ",Att1='" + employyAttRecordDataGridView.Rows[i].Cells["Att1Col"].Value.ToString()+"'";
                if (employyAttRecordDataGridView.Rows[i].Cells["Att2Col"].Value.ToString() != string.Empty) sqlstring += ",Att2='" + employyAttRecordDataGridView.Rows[i].Cells["Att2Col"].Value.ToString() + "'";
                if (employyAttRecordDataGridView.Rows[i].Cells["Att3Col"].Value.ToString() != string.Empty) sqlstring += ",Att3='" + employyAttRecordDataGridView.Rows[i].Cells["Att3Col"].Value.ToString() + "'";
                if (employyAttRecordDataGridView.Rows[i].Cells["Att4Col"].Value.ToString() != string.Empty) sqlstring += ",Att4='" + employyAttRecordDataGridView.Rows[i].Cells["Att4Col"].Value.ToString() + "'";
                if (employyAttRecordDataGridView.Rows[i].Cells["Att5Col"].Value.ToString() != string.Empty) sqlstring += ",Att5='" + employyAttRecordDataGridView.Rows[i].Cells["Att5Col"].Value.ToString() + "'";
                if (employyAttRecordDataGridView.Rows[i].Cells["Att6Col"].Value.ToString() != string.Empty) sqlstring += ",Att6='" + employyAttRecordDataGridView.Rows[i].Cells["Att6Col"].Value.ToString() + "'";
                sqlstring += " where recordid=" + employyAttRecordDataGridView.Rows[i].Cells["RecordID"].Value.ToString();
                mysqls.Add(sqlstring);
                    
            }
            db.ExecDataBySqls(mysqls);


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值