zoukankan
html css js c++ java
SQL语句
private
string
GetSQL()
{
string
strSQL;
//
strSQL = "select UID,MobileNum,DateTime,PayFlag,grade from SMS_Log where ";
strSQL
=
"
select UID,MobileNum,DateTime,PayFlag=case PayFlag when 0 then '未处理' when 1 then '成功扣费' when 2 then '扣费失败' end,grade=case grade when 0 then '未获奖' when 1 then '一等奖' when 2 then '二等奖' when 3 then '三等奖' end from SMS_Log where
"
;
strSQL
+=
"
1=1
"
;
//
什么都不选的情况
if
(tbUID.Text
!=
""
)
{
strSQL
+=
"
and
"
;
strSQL
+=
"
UID=N'
"
+
tbUID.Text.Trim()
+
"
'
"
;
//
选择用户ID的情况
}
if
(tbBeginTime.Value
!=
""
)
{
strSQL
+=
"
and
"
;
strSQL
+=
"
DateTime>'
"
+
tbBeginTime.Value
+
"
'
"
;
//
选择起始时间的情况,格式2005-4-27 17:33:04
}
if
(tbEndTime.Value
!=
""
)
{
strSQL
+=
"
and
"
;
strSQL
+=
"
DateTime<'
"
+
tbEndTime.Value
+
"
'
"
;
//
选择结束时间的情况
}
if
(cblSelect.SelectedIndex
==
0
)
{
strSQL
+=
"
and
"
;
strSQL
+=
"
PayFlag=1
"
;
//
选择成功扣费的情况,单选
}
if
(cblSelect.SelectedIndex
==
1
)
{
strSQL
+=
"
and
"
;
strSQL
+=
"
PayFlag=2
"
;
//
选择扣费失败的情况,单选
}
if
(cblSelect.SelectedIndex
==
2
)
{
strSQL
+=
"
and
"
;
strSQL
+=
"
PayFlag=0
"
;
//
选择未处理的情况,单选
}
return
strSQL;
}
查看全文
相关阅读:
mysql中的几种join 及 full join问题
MySQL基础练习题
SQL之IFNULL()
SQL之查找表中字段的值相同的记录
Mysql之将一张表内容导入另一张表中
selenium无界面操作浏览器与Chrome Options的启动项设置
SQL UNION 和 UNION ALL 操作符
Python断言方法assert
Python标准库--contextlib模块
Python标准库--itertools模块
原文地址:https://www.cnblogs.com/xiaodi/p/148228.html
最新文章
微服务架构中如何解决连表查询的问题?
计划任务批处理访问一个URL并自动打开浏览器运行,且运行完毕后关闭浏览器
升级到Chrome 80+的SameSite问题,及Asp.net和aspnetcore站点修改
.net core还原packages包到指定目录
.net core设置文件夹复制到输出目录(如果较新则复制)
.net core使用 dotnet watch run(实时监测代码修改,自动编译运行)
windows系统安装curl
Cookie 的 SameSite 属性
什么是SVM
Tensorflow-gpu搭建CUDA 10.0与cuDNN等版本问题
热门文章
configparser模块简介
python使用os.listdir和os.walk获得文件的路径
sys.path.insert(0,"/path") 的用法
pycharm中使用正则表达式批量添加print括号
CV2/ConfigParser
ResNet学习
visualization of filters keras 基于Keras的卷积神经网络(CNN)可视化
一文让你彻底了解卷积神经网络
JDK安装及环境变量配置
数据库中列名有空格时如何写SQL
Copyright © 2011-2022 走看看