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!

ADO Question

Status
Not open for further replies.

dizzyh

Programmer
Jul 12, 2004
4
ZA
Hi all

I have a program that accesses a access db. I have gotten the program to insert records into the db, but I cant get the records to display in the dialog? Are record sets limited to the amount of fields they can read from the db, or is there perhaps something in my code that is causing this?

below is my code where I connect to the db:

m_strConnection = _T("DSN=Report_prg");
m_strCmdText = _T("Select * From R_tbl");
m_pConnection = NULL;
m_pCommand = NULL;
m_pRs = NULL;
m_piADORecordBinding = NULL;


try
{
::CoInitialize(NULL);
m_pConnection.CreateInstance (__uuidof(Connection));
m_pCommand.CreateInstance (__uuidof(Command));
m_pRs.CreateInstance(__uuidof(Recordset));
m_pRs->Open(LPCTSTR(m_strCmdText),LPCTSTR(m_strConnection),adOpenDynamic,adLockOptimistic,adCmdUnknown);

if(FAILED(m_pRs->QueryInterface(__uuidof(IADORecordBinding),(LPVOID*)&m_piADORecordBinding)))
_com_issue_error(E_NOINTERFACE);
m_piADORecordBinding->BindToRecordset(&m_rsRecSet);
RefreshBoundData();
}
catch(_com_error &e)
{
GenerateError(e.Error(),e.Description());
}

Any help would be appreciated!
Thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top