I have a problem with the below piece of code which tries to connect to a table in a remote Informix database. I get the error, cannot find DSN name or no default driver specified. I have checked my ODBC Informix driver 2.8 settings and all are correct. The program even finds other tables within the database. Perhaps it has somethinng to do with an ini file which it cannot access. The code is below:
// mstrsndb.cpp : implementation file
//
#include "stdafx.h"
#include "LBWC_new.h"
#include "mstrsndb.h"
#include "SNDB_DFT.H"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMstrSnDB
IMPLEMENT_DYNAMIC(CMstrSnDB, CRecordset)
CMstrSnDB::CMstrSnDB(CDatabase* pdb)
: CRecordset(pdb)
{
//{{AFX_FIELD_INIT(CMstrSnDB)
m_serialnum = _T("");
m_board_source_code = 0;
m_rev_level = _T("");
m_assy_code = _T("");
m_confirmed = 0;
m_nFields = 6;
//}}AFX_FIELD_INIT
}
CString CMstrSnDB::GetDefaultConnect()
{
return _T(rmt_sn_connect);
}
CString CMstrSnDB::GetDefaultSQL()
{
return _T(master_sn_tbl);
}
void CMstrSnDB::DoFieldExchange(CFieldExchange* pFX)
{
//{{AFX_FIELD_MAP(CMstrSnDB)
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text(pFX, "serialnum", m_serialnum);
RFX_Date(pFX, "time_stamp", m_time_stamp);
RFX_Int(pFX, "board_source_code", m_board_source_code);
RFX_Text(pFX, "rev_level", m_rev_level);
RFX_Text(pFX, "assy_code", m_assy_code);
RFX_Int(pFX, "confirmed", m_confirmed);
//}}AFX_FIELD_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CMstrSnDB diagnostics
#ifdef _DEBUG
void CMstrSnDB::AssertValid() const
{
CRecordset::AssertValid();
}
void CMstrSnDB::Dump(CDumpContext& dc) const
{
CRecordset::Dump(dc);
}
#endif //_DEBUG