请输入查询关键字:_______________      查询
  里面输入学号 或者 姓名 或者 班级  都能查到 的 数据库查询语句 

解决方案 »

  1.   

    补充下  表  :student   
           列名: stuID  ,stuName,class
           输入的字:String name=this.jtf1.getText().trim();
      

  2.   

    select * from 表名 where 学号=关键字 or 姓名=关键字 or 班级=关键字
      

  3.   

    select * from  AAA  where (学号 like '%输入值%') or (姓名 like '%输入值%') or (班级 like '%输入值%') ;
      

  4.   

    补充下 表 :student  
      列名: stuID ,stuName,class
      输入的字:String name=this.jtf1.getText().trim();
    String sql = "select * from student where (stuID = " + name + " ) or  ( stuName like '% " + 
    name +"%') or (class  like '%" + name "%') "  ;
      

  5.   


    if not object_id('tempdb..#Student') is null
    begin
    drop table #Student
    end
    create table #Student(stu_id nvarchar(36),stu_name nvarchar(36),stu_class nvarchar(36))
    insert into #Student
    select '1','a','b' union all
    select '2','b','b' union all
    select '3','c','b' union all
    select '4','d','c' union all
    select '5','e','d' 
    select * from #Student where stu_id='c' or stu_name='c' or stu_class='c'/*
    3 c b
    4 d c
    */
      

  6.   

    如果是模糊查询,就用各个字段 like '%输入的信息%',然后or各个条件就可以了
    如果是精确查询,就用各个字段 = '输入信息',然后or各个条件
    for example--模糊查询
    select * from student   
     where stuID like '%' || your_text || '%'
        or stuName like '%' || your_text || '%'
        or [class] like '%' || your_text || '%'--精确查询
    select * from student   
     where stuID = your_text
        or stuName = your_text
        or [class] = your_text
      

  7.   

      查询stuID和class是对的,但是查询姓名stuName时候报错 [Microsoft][ODBC Microsoft Access 驱动程序] 参数不足,期待是 1。
      

  8.   


    谢谢了,我试了,都用like 才可以,终于完成程序了。。