Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am using Visual C++ 6.0 and tryin

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Visual C++ with Query

I am trying to run this query using CRecordset.

CDatabase F2000;
F2000.SetQueryTimeout(0);
F2000.SetLoginTimeout(0);
F2000.Open(NULL);
CRecordset F2000_Record(&F2000);
F2000_Record.Open(CRecordset::forwardOnly,("SELECT " //distinct ROOT.a_ap_d.CONTRACTOR,"
"'ROOT.a_ap_d.ADDRESS_CODE',"
"'ROOT.a_ap_d.INVOICE_NO',"
"'ROOT.a_ap_d.INVOICE_DATE',"
"'ROOT.a_ap_d.LINE_SEQ',"
"'ROOT.a_ap_d.ITEM',"
"'ROOT.a_ap_d.TAX_CODE',"
"'ROOT.a_ap_d.RTC',"
"'ROOT.a_ap_d.SUPPL_DATA_CODE',"
"'ROOT.a_ap_d.DESCR',"
"'ROOT.a_ap_d.ITEM_QTY',"
"'ROOT.a_ap_d.ITEM_UOM',"
"'ROOT.a_ap_d.ITEM_UNIT_COST',"
"'ROOT.a_ap_d.ITEM_INV_AMT',"
"'ROOT.a_ap_d.ITEM_TAX_AMT',"
"'ROOT.a_ap_d.ITEM_EXT_AMT',"
"'ROOT.a_ap_d.ITEM_PERC'"
"FROM ROOT.a_apinv_dis,"
"ROOT.a_ap_h,"
"ROOT.a_ap_d"
"WHERE ('ROOT.a_apinv_dis.CONTRACTOR' = 'ROOT.a_ap_h.CONTRACTOR') AND"
"('ROOT.a_apinv_dis.ADDRESS_CODE' = 'ROOT.a_ap_h.ADDRESS_CODE') AND"
"('ROOT.a_apinv_dis.INVOICE_NO' = 'ROOT.a_ap_h.INVOICE_NO') AND"
"('ROOT.a_apinv_dis.INVOICE_DATE' = 'ROOT.a_ap_h.INVOICE_DATE') AND"
"('ROOT.a_ap_h.CONTRACTOR' = 'ROOT.a_ap_d.CONTRACTOR') AND"
"('ROOT.a_ap_d.ADDRESS_CODE' = 'ROOT.a_ap_h.ADDRESS_CODE') AND"
"('ROOT.a_ap_d.INVOICE_NO' = 'ROOT.a_ap_h.INVOICE_NO') AND"
"('ROOT.a_ap_d.INVOICE_DATE' = 'ROOT.a_ap_h.INVOICE_DATE') AND"
"('ROOT.a_ap_d.LINE_SEQ' = 'ROOT.a_apinv_dis.LINE_SEQ') AND"
"('ROOT.a_apinv_dis.INVOICE_DATE >= '01-FEB-02') AND'"
&quot;('ROOT.a_apinv_dis.INVOICE_DATE < '31-MAR-02') AND'&quot;
&quot;'ROOT.a_apinv_dis.AF2' in ('5541','5542','5051','M000') AND&quot;
&quot;'ROOT.a_apinv_dis.AF1' = '661' AND&quot;
&quot;'ROOT.a_ap_h.INVOICE_TYPE' = 'U' AND&quot;
&quot;'ROOT.a_ap_h.CURR_PRC_CODE' not like 'PROFILE%'&quot;));

If I take out the Where Clause it runs. Does anyone know how I should format this to run properly. I am connecting using ODBC and connect fine. I bomb out in the query at the where.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top