易截截图软件、单文件、免安装、纯绿色、仅160KB

请教sql语句拼接的问题 - .NET技术 / C#

例如我现在在数据库中有这么几条数据:学号,姓名,班级,班主任ID,出生日期
我在查询学生信息界面中要求可以根据以上5条数据中的任意一项或多项查询出数据
我自己写的sql语句拼接如下:
C# code:

string strsql = "select * from stu where ";
if (stuNum != "")
{
strsql += "stuNum like '%" + stuNum + "%' and ";
}
else
{
strsql += "stuNum like '%%' and ";
}
if (stuName != "")
{
strsql += "stuName ='" + stuName + "' and ";
}
if (beginDate != "")
{
strsql += "createdate>=to_date('" + beginDate + " 00:00:00 " + "','yyyy-mm-dd hh24:mi:ss')" + " and ";
}
if (endDate != "")
{
strsql += "createdate<=to_date('" + endDate + " 23:59:59 " + "','yyyy-mm-dd hh24:mi:ss')" + " and ";
}
if (type != "")
{
strsql += "type ='" + type + "' and ";
}
if (consumer != "")
{
strsql += &qu


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

C# DataSet导出xml 批处理(循环)得怎么处理

DataSet导出xml 批处理(循环)得怎么处理
XML文件
<A>
      <B>
        <C>
        </C>
  &nb ......

c# Winform 触摸屏程序 - .NET技术 / C#

公司开发一个触摸屏程序,我负责的一块,实现这样一个功能,当鼠标点击窗口中图片(一张图分成几部分)的其中一部分时,将这部分图片截取出来,弹出新的窗口,将截取出的图片显示出来。我使用Rectange类控制了返回, ......

sql语句问题 - MS-SQL Server / 疑难问题

现在有一个部门表dept(部门名称,部门号。。)有一个人员表emp(姓名,人员编号,职位,薪资,部门)
emp表中的内容是这样的:
a 1 工程师 3000 软件部
b 2 普通员工 2000 硬件部
c 3 工程师 4000 硬件部
d ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号