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++;
}
uj5u.com熱心網友回復:
不太明白你問的什么sql陳述句中是不需要斜杠的
sql.Format(_T("insert INTO dt_doc_defaulttaskfortemplate (common_id,temmonid,titlenum,titlename,fulle,speme,parentid,sortnum) VALUES " )\
_T( "(%d,%s,'%s','%s','%s','%s',%d,%d)"),
‘%s' 代表在資料庫中的型別是字符型別
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/121796.html
標籤:界面
下一篇:MFC出現錯誤怎么修正
