Click to See Complete Forum and Search --> : Invalid descriptor number, Invalid column number calling CRecordset::Open


zulus
February 27th, 2003, 08:15 AM
Hello everybody.

I have a problem i cannot defeat. I created a database in mysql and now i want to retrieve records from it. I use VC++6.0

I do it with fallowing piece of code:

CDatabase db;
CUserSet* pUserSet = new CUserSet();
if(db.Open("firm"))
{
try
{
pUserSet -> Open(CRecordset::snapshot,"select * from referers");
pUserSet -> Close();
db.Close();
delete pUserSet;
}
catch(CDBException* pe)
{
MessageBox (pe->m_strError);
db.Close();
delete pUserSet;
}
}

// referers is a table in my database

all looks fine and great till i want to get a row but not from all columns(*) but for example from only one (referer_id)

i changed the sql query syntax to : "select referer_id from referers" and then i get an error:

Invalid column number, Invalid descriptor number.

I spent few days trying to figure it out but without success.
Can anyone knows the reason of this error??

any help appreciated
Thanks