我数据库表里面有三个字段 脉宽 脉间 电流 都是整形的 设置的脉宽为主键
在链表List里面打开,我现在要删除一组数据的话怎么弄
下面是我源代码 删除CString类型的没问题 但是我现在是整形的 我该怎么改
int nItem=m_list_info.GetSelectionMark();
if(nItem==-1)
{
AfxMessageBox("请在列表中选择待删除的项目!");
return;
}
  CString strItem=m_list.GetItemText(nItem,0);//CString类型的 这句要怎么改啊
  CString strSql;
  strSql.Format("DELETE FROM 电参数 WHERE [脉宽]=\'%s\'",strItem);//这句要怎么改
  m_Database.ExecuteSQL(strSql);
UpdateList();

解决方案 »

  1.   

    CString strItem=m_list.GetItemText(nItem,0);
    int nItem = atoi(strItem);
      CString strSql;
      strSql.Format("DELETE FROM 电参数 WHERE [脉宽]=\'%i\'",nItem );
      m_Database.ExecuteSQL(strSql);
      

  2.   

    strSql.Format("DELETE FROM 电参数 WHERE [脉宽]=\'%i\'",nItem );
    这句把逗号去掉。如果是ORALCE的话,不去也可。
      

  3.   

    CString strItem=m_list.GetItemText(nItem,0);//应该是对的
    strSql.Format("DELETE FROM 电参数 WHERE [脉宽]=\'%s\'",strItem);
    脉宽是整数型的话,查询条件里不应该加单引号
    strSql.Format("DELETE FROM 电参数 WHERE [脉宽]=%s",strItem);