void PipeQuery::OnBnClickedSerBtn()
{
if(!m_pDatabase || !m_pDatabase->IsOpen())
{
return;
}
CADORecordset* p_ref = new CADORecordset(m_pDatabase);
this->UpdateData(TRUE);
CString cstr_SQL;
m_listcontrol.DeleteAllItems(); // 清除所有组
[i] cstr_SQL.Format("select * from %s  where \'%s\' \'%s\' \'%s\'  ","DZGX1",cListLeft,strCBText,m_Input_Edit);[/i]//连接语句这个地方可以这样写吗?,DZGX1是数据库表, CWaitCursor at;
if (!p_ref->Open(cstr_SQL))
{
delete p_ref; p_ref=NULL;
return;
}
int iRowIndex = 0;
while(!p_ref->IsEOF())
{
CString cstr_temp;
p_ref->GetFieldValue(_T("上点号"),cstr_temp);
int iColIndex = m_listcontrol.InsertItem(iRowIndex, cstr_temp, 0); p_ref->GetFieldValue(_T("本点号"), cstr_temp);
m_listcontrol.SetItemText(iRowIndex, ++iColIndex, cstr_temp); p_ref->GetFieldValue(_T("管线种类"), cstr_temp);
m_listcontrol.SetItemText(iRowIndex, ++iColIndex, cstr_temp); p_ref->GetFieldValue(_T("管线材料"), cstr_temp);
m_listcontrol.SetItemText(iRowIndex, ++iColIndex, cstr_temp); p_ref->GetFieldValue(_T("填埋方式"), cstr_temp);
m_listcontrol.SetItemText(iRowIndex, ++iColIndex, cstr_temp); p_ref->GetFieldValue(_T("管径"), cstr_temp);
m_listcontrol.SetItemText(iRowIndex, ++iColIndex, cstr_temp);
p_ref->MoveNext();
iRowIndex++;

}