sql.Format(_T("select ID,EndTime from TDigSchedule where StartTime<'"+m_stime+"' and EndTime>'"+m_stime+"'"));
sCommand=sql;
rs=pConn->Execute(sCommand,&val,0);
运行到第三句,弹出对话框说,unhandle exception
不知道是什么原因

解决方案 »

  1.   

    sql.Format(_T("select ID,EndTime from TDigSchedule where StartTime<'"+m_stime+"' and EndTime>'"+m_stime+"'"));这个sql语句对吗?
      

  2.   

    看样子你的SQL语句里使用了时间,你的数据库是否要求特定的格式?例如:EndTime > to_time(m_stime,'HH:MI:SS')
      

  3.   

    回afantict(非洲土狼)
    这句话可以在sql里面正常运行
      

  4.   

    sql.Format(_T("select ID,EndTime from TDigSchedule where StartTime<'"+m_stime+"' and EndTime>'"+m_stime+"'"));
    sCommand=sql;
    rs=pConn->Execute(sCommand,&val,0);是rs=pConn->Execute(sCommand,&val,0);这个地方的问题吗?那你的pConn是不是有问题看看
      

  5.   

    捕获异常,查找错误原因
    try{
    rs=pConn->Execute(sCommand,&val,0);
    }
    catch(_com_error& e)
    {
       MessageBox(e.ErrorMessage());
       NessageBox(e.Description());
    }
      

  6.   

    楼上的,我写了捕获异常的代码了,但是没有运行到catch里面,而是直接弹出一个对话框,上面提示就是unhandle exception,
    楼上的楼上,我在看看,在回答你
      

  7.   

    void main()
    {
        try{
          //all your code, including function call
        }
       catch(_com_error& e)
      {
          MessageBox(e.ErrorMessage());
          NessageBox(e.Description());
       }
       catch(...)
       {
          ::MessageBox(NULL, "error");
       }
        
    }