Newbie: How do I get the value of a recordset field 
Author Message
 Newbie: How do I get the value of a recordset field

Instead of transferring data directly from a recordset field to a
dialog control, which MFC does (pretty much) automatically with DDX/V
commands, I want to get a field value to mess with myself before
setting the dialog control.

Here's the code.

Quote:
> // Create and set initial values
> char* valueSex = "0";
> char* textSex = "not specified";

> // Create pointer to Edit control on dialog
> CEdit* pSex = (CEdit*)GetDlgItem(IDC_SEX);

> // Get field value IN THEORY
> m_pSet->GetFieldValue(valueSex, m_pSet->m_Sex);

> // Work out what to put in Edit control
> IF (valueSex == "2")
>    textSex = "Female";
> ELSE
> {
>    IF (valueSex == "1")
>            textSex = "Male";
>    ELSE
>    {
>            IF (valueSex == "0")
>                    textSex = "not specified";
>    }
> }

> // Write result to Edit control
> pSex->SetWindowText(textSex);

This is the closest I got so far, but the "GetFieldValue" command
doesn't work.

If anyone can give me any advice I'd be really grateful, or even
pointers to an example or three would be great.

-- Alistair


http://www.*-*-*.com/

--


http://www.*-*-*.com/

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Thu, 01 Aug 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Newbie: How do I get the value of a recordset field

2. How to get fields value from ado recordset?

3. HELP: Problem with Recordset->Fields(index)->Value

4. cannot read long varchar field values from ADO Recordsets

5. EVC ADOCE Recordset get value from data field

6. ODBC recordset not getting all fields???

7. Problems getting values from ADO Recordset

8. Problems getting values from ADO Recordset

9. Problems getting values from ADO Recordset

10. Getting value from an Identity field using ADO

11. Getting key field value after insert

12. howto: getting field value with DAO classes

 

 
Powered by phpBB® Forum Software