//拼接查询条件
private string GetSearchCondition()
{
StringBuilder sb = new StringBuilder();
//物理地址
if (string.IsNullOrEmpty(this.txtMacAdd.Text.Trim()))
sb.Append("1=1 AND ");
else
sb.Append(string.Format("MACAddress LIKE '%{0}%' AND ",this.txtMacAdd.Text.Trim()));
//灯具名称
if (string.IsNullOrEmpty(this.txtLightName.Text.Trim()))
sb.Append("1=1 AND ");
else
sb.Append(string.Format("LightName LIKE '%{0}%' AND ", this.txtLightName.Text.Trim()));
//备注
if (string.IsNullOrEmpty(this.txtMemo.Text.Trim()))
sb.Append("1=1 AND ");
else
sb.Append(string.Format("Memo LIKE '%{0}%' AND ", this.txtMemo.Text.Trim()));
//灯具编号
if (string.IsNullOrEmpty(this.txtLedId.Text.Trim()))
sb.Append("1=1 ");
else
sb.Append(string.Format("ledId LIKE '%{0}%' ", this.txtLedId.Text.Trim()));
return sb.ToString();
}
private string GetSearchCondition()
{
StringBuilder sb = new StringBuilder();
//物理地址
if (string.IsNullOrEmpty(this.txtMacAdd.Text.Trim()))
sb.Append("1=1 AND ");
else
sb.Append(string.Format("MACAddress LIKE '%{0}%' AND ",this.txtMacAdd.Text.Trim()));
//灯具名称
if (string.IsNullOrEmpty(this.txtLightName.Text.Trim()))
sb.Append("1=1 AND ");
else
sb.Append(string.Format("LightName LIKE '%{0}%' AND ", this.txtLightName.Text.Trim()));
//备注
if (string.IsNullOrEmpty(this.txtMemo.Text.Trim()))
sb.Append("1=1 AND ");
else
sb.Append(string.Format("Memo LIKE '%{0}%' AND ", this.txtMemo.Text.Trim()));
//灯具编号
if (string.IsNullOrEmpty(this.txtLedId.Text.Trim()))
sb.Append("1=1 ");
else
sb.Append(string.Format("ledId LIKE '%{0}%' ", this.txtLedId.Text.Trim()));
return sb.ToString();
}