void CDLGSetBlack::OnButtonBlackAdd() { // TODO: Add your control notification handler code here UpdateData(TRUE); if(m_Plate.IsEmpty()) { MessageBox("车牌号不为空",MESSAGEBOX_TITLE); return ; } //插入数据库 M2Struct(); #if ALLTAB_DETECT_CAR_MODE if(!OracleIO.CAR_BlackTable_AddNew(data)) #else if(!OracleIO.ELECAR_BlackTable_AddNew(data)) #endif { MessageBox("数据库错误:无法增加",MESSAGEBOX_TITLE); return ; } else { MessageBox("添加成功",MESSAGEBOX_TITLE); } //重新载入 reflush(); }
bool XMLRW::ReadXml(char *XmlFile) { // 定义一个TiXmlDocument类指针 TiXmlDocument *pDoc = new TiXmlDocument(XmlFile); if (NULL==pDoc) { return false; } pDoc->LoadFile(TIXML_ENCODING_UTF8); TiXmlElement *pRootEle = pDoc->RootElement(); if (NULL==pRootEle) { return false; } pDlgBlackInout->GetDlgItem(IDC_STATIC_INFO)->SetWindowText("已读取: 0 条"); char temp[XMLRW_MAX_STR]; struct BLACK_DATA_ST data={0}; TiXmlElement *pNodeRow = NULL; TiXmlElement *pNodeData = NULL; unsigned long int i=1; for(pNodeRow = pRootEle; pNodeRow; pNodeRow = pNodeRow->NextSiblingElement()) { memset(&data,0,sizeof(struct BLACK_DATA_ST)); //获取信息 if(ReadQueryNodeText(pNodeRow,pNodeRow,"ROW",temp)) { pNodeData = NULL; ReadQueryNodeText(pNodeRow,pNodeData,"SCARNUMBER",data.plate); pNodeData = NULL; ReadQueryNodeText(pNodeRow,pNodeData,"SBRAND",data.brand); pNodeData = NULL; ReadQueryNodeText(pNodeRow,pNodeData,"SLOSTNAME",data.name); pNodeData = NULL; ReadQueryNodeText(pNodeRow,pNodeData,"SPHONE",data.Phone); pNodeData = NULL; ReadQueryNodeText(pNodeRow,pNodeData,"SMARK",data.other); //车牌号为空 if(0==strlen(data.plate)) continue ; //写入一条 #if ALLTAB_DETECT_CAR_MODE //汽车 if(OracleIO.CAR_BlackTable_AddNew(data)) #else //电动车 if(OracleIO.ELECAR_BlackTable_AddNew(data)) #endif { pDlgBlackInout->m_info.Format("已导入: %d 条",i); pDlgBlackInout->GetDlgItem(IDC_STATIC_INFO)->SetWindowText(pDlgBlackInout->m_info); i++; } } } return true; }