想要按学号查询数据库中是否包含该数据项   返回bool值   该怎么操作啊
顺便问下
strSQL1="select * from student where code = studentid";
strSQL2.Format("select * from outgrade where code = %s",studentid);
strSQL的值有什么不同啊    

解决方案 »

  1.   

    顺便问下
    strSQL1="select * from student where code = studentid";
    strSQL2.Format("select * from outgrade where code = %s",studentid);
    strSQL的值有什么不同啊 但从这两句话,没什么区别
    第一句是写死了,以后要改变studentid很困难
    第二句则可以从参数里传studentid
      

  2.   

    可以通过查询返回的条目处理,如果是0 就没有值
    顺便问下
    strSQL1="select * from student where code = studentid";
    strSQL2.Format("select * from outgrade where code = %s",studentid);
    strSQL的值有什么不同啊 第一句输出为:select * from student where code = studentid  
    第二句输出为:select * from outgrade where code = studentid变量的值
      

  3.   

    "select count(id)as num from student where code =%s",studentid"
    GetCollection(num);这个语句中  num 是 整型还是  Cstring 类型
    返回的是 符合条件的id  的个数  ???????m_pDatabase-> ExecuteSQL(strSQL);  执行数据库有什么作用 啊   看到有些代码有加有些没加