62,046
社区成员
发帖
与我相关
我的任务
分享
update table set field= case when '你的变量'='' then field else '你的变量' end
if not isnull(ls_tradetype) or ls_tradetype<>'' then
ls_appendsql+=" and TradeType='"+ls_tradetype+"' "
end if
//
if not isnull(ldt_start) then
ls_appendsql += ' and SaleDate >= '+"'"+string(ldt_start,'yyyy.mm.dd')+"'"
end if
if not isnull(ldt_start) then
ls_appendsql += ' and SaleDate <= '+"'"+string(ldt_end,'yyyy.mm.dd')+" 23:59:59'"
end if
//
ls_storecode = trim(dw_title.object.storecode[ll_row])
if not isnull(ls_storecode) and trim(ls_storecode) <> '' then
ls_appendsql += ' and StoreCode = '+"'"+ls_storecode+"' "
end if
ls_posid = trim(dw_title.object.posid[ll_row])
if not isnull(ls_posid) and trim(ls_posid) <> '' then
ls_appendsql += ' and PosID = '+"'"+ls_posid+"' "
end if
ls_vipcard = trim(dw_title.object.vipcard[ll_row])
if not isnull(ls_vipcard) and trim(ls_vipcard) <> '' then
ls_appendsql += ' and VipCard = '+"'"+ls_vipcard+"' "
end if
ls_tradeno = trim(dw_title.object.tradeno[ll_row])
if not isnull(ls_tradeno) and trim(ls_tradeno) <> '' then
ls_appendsql += ' and TradeNo like '+"'%"+ls_tradeno+"%' "
end if
ls_operator = trim(dw_title.object.operator[ll_row])
if not isnull(ls_operator) and trim(ls_operator) <> '' then
ls_appendsql += ' and Operator = '+"'"+ls_operator+"' "
end if
string xuhao =xuhaoTb.Text.Trim();
string zichanbianhao = zichanbianhaoTb.Text.Trim();
string guanzhibianhao = guanzhibianhaoTb.Text.Trim();
string sn = snTb.Text.Trim();
string xinghao = xinghaoTb.Text.Trim();
string loudong = loudongTb.Text.Trim();
string jifang = jifangTb.Text.Trim();
string jigui = jiguiTb.Text.Trim();
string mac = macTb.Text.Trim();
string ipaddress = ipaddressTb.Text.Trim();
string shiyechu = shiyechuTb.Text.Trim(); ;
string beizhu =beizhuTb.Text.Trim();
string baoguanren =baoguanrenTb.Text.Trim();
string zhixingsqlcode = "";//定义执行的具体的sql语句代码
string zhixingdongzuo = "";//定义判断具体执行sql方法的判断条件的值
zhixingdongzuo = zhixingdongzuozhi.SelectedValue;//给判断值变量赋值,以便程序生成具体的sql代码
switch (zhixingdongzuo)
{
case "新增":
zhixingsqlcode = "insert into networkzichan (资产编号,HH编号,型号,楼栋,机房,机柜,MAC地址,IP地址,SN,事业处,备注,资产保管人) VALUES ('" + zichanbianhao + "','" + guanzhibianhao + "','" + xinghao + "','" + loudong + "','" + jifang + "','" + jigui + "','" + mac + "','" + ipaddress + "','" + sn + "','" + shiyechu + "','" + beizhu + "','" + baoguanren + "');";
break;
case "更新":
if (xuhao != "") { };
;
break;
case "删除":
;
break;
case "导出":
;
break;
default:
if (xuhao != "")
zhixingsqlcode = "select 序号,资产编号,HH编号,型号,楼栋,机房,机柜,MAC地址,IP地址,SN,事业处,备注,资产保管人 from networkzichan where 序号= '" + xuhao + "' and 资产编号 like '%" + zichanbianhao + "%'" + " and HH编号 like '%" + guanzhibianhao + "%'" + " and SN like '%" + sn + "%'" + " and 型号 like '%" + xinghao + "%'" + " and 楼栋 like '%" + loudong + "%'" + " and 机房 like '%" + jifang + "%'" + " and 机柜 like '%" + jigui + "%'" + " and MAC地址 like '%" + mac + "%'" + " and IP地址 like '%" + ipaddress + "%'" + " and 事业处 like '%" + shiyechu + "%'" + " and 备注 like '%" + beizhu + "%'" + " and 资产保管人 like '%" + baoguanren + "%';";
else
zhixingsqlcode = "select 序号,资产编号,HH编号,型号,楼栋,机房,机柜,MAC地址,IP地址,SN,事业处,备注,资产保管人 from networkzichan where 资产编号 like '%" + zichanbianhao + "%'" + " and HH编号 like '%" + guanzhibianhao + "%'" + " and SN like '%" + sn + "%'" + " and 型号 like '%" + xinghao + "%'" + " and 楼栋 like '%" + loudong + "%'" + " and 机房 like '%" + jifang + "%'" + " and 机柜 like '%" + jigui + "%'" + " and MAC地址 like '%" + mac + "%'" + " and IP地址 like '%" + ipaddress + "%'"+ " and 事业处 like '%" + shiyechu + "%'" + " and 备注 like '%" + beizhu + "%'" + " and 资产保管人 like '%" + baoguanren + "%';";
break;
}