TO: Inpras ( in viewing ur reply)

Hi, Inpras,

pls read my new post in the original qn.
thanks a lot!
greenbirdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

greenbirdAuthor Commented:
Edited text of question.
0
greenbirdAuthor Commented:
Edited text of question.
0
inprasCommented:
Hi
Yes U can build a project without database support but with support is better , now see how a code should be written in OnButton1 for without file support

.....

CDatabase db;
      db.Open("MyDB", FALSE, FALSE, "ODBC;", TRUE );
CRecordset rs(&db);
........
in above MyDB is DSN U have created for UR databse in ODBC
U can further use rs for the calculation

Now as of UR first question
I think U dont't have field3 in UR table. If U don't have it how UR going to update it? For that U have to add a new field in the table and then update. it see how U have to do that
for adding column in table
using the above variable db
.....
      db.ExecuteSQL("ALTER TABLE MyTab ADD field3 CHAR(10)");
.....
****remember the above line should be executed only once first time U come if that filed is there then U need not do this.********

then use UR code written earlier to add the entries
Hope I am clear this time

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

greenbirdAuthor Commented:
Hi, Inpras,

still got error . :(

the code:
// this version did not use the database support, rite?
CDatabase db;
db.Open("mydata", FALSE, FALSE, "ODBC;", TRUE );
CRecordset rs(&db);
db.ExecuteSQL("ALTER TABLE BU3_94 ADD Field3 CHAR(10));
while(!(rs.IsEOF())) {
       if((strcmp(rs.HCATR,"N")==0))
   &&(strcmp(m_pSet->m_HCATL,"N")==0))
 {
         rs.Edit();                                                                                                         
        rs.Field3 = "N";
        rs.HCATR = "";
        rs.HCATL = strdup("");
         rs.Update();
   }
      

the error is "HCAT_L HCAT_R Field3" are not members of CRecordset.

how?

thanks a lot!                  
0
inprasCommented:
give me UR email ID I will send U my work space
0
inprasCommented:
Once U create table's new col open it again
db.ExecuteSQL("ALTER TABLE BU3_94 ADD Field3 CHAR(10));
CRecordset rs(&db);
rs.Open(...);
0
greenbirdAuthor Commented:
Hi,

the problem now is that i do not know why it always says
m_HCATR m_HCATL ets is not a member.  i have the following classes already:
class CSectionSet : public CRecordset
{
public:
      CSectionSet(CDatabase* pDatabase = NULL);
      DECLARE_DYNAMIC(CSectionSet)
      CSectionSet::~CSectionSet();

// Field/Param Data
      //{{AFX_FIELD(CSectionSet, CRecordset)
      CString      m_NRIC;
      CString      m_RACE;
      CString      m_CLIN;
      CString      m_SEX;
      CTime      m_DOB;
      CTime      m_DOS;
      CString      m_CTYP;
      CString      m_CSRC;
      double      m_HDUR;
      CString      m_HHYP;
      CString      m_HCATR;
      CString      m_HCATL;
      CString      m_HVAUR;
      CString      m_HVAUL;
      CString      m_HVAPR;
      CString      m_HVAPL;
      double      m_HDIOR;
      double      m_HDIOL;
      CString      m_FCATR;
      CString      m_FCATL;
      CString      m_FCUPR;
      CString      m_FCUPL;
      CString      m_FNOUR;
      CString      m_FNOUL;
      CString      m_FMACR;
      CString      m_FMACL;
      CString      m_FDIAR;
      CString      m_FDIAL;
      CString      m_FLASR;
      CString      m_FLASL;
      CString      m_FFFSR;
      CString      m_FFFSL;
      CString      m_FPOSR;
      CString      m_FPOSL;
      CString      m_FCRER;
      CString      m_FCREL;
      CString      m_FSRNR;
      CString      m_FSRNL;
      CString      m_FGEOR;
      CString      m_FGEOL;
      CString      m_FDRUR;
      CString      m_FDRUL;
      CString      m_FHYPR;
      CString      m_FHYPL;
      CString      m_FMYER;
      CString      m_FMYEL;
      CString      m_FBRVR;
      CString      m_FBRVL;
      CString      m_FCRVR;
      CString      m_FCRVL;
      CString      m_FRPER;
      CString      m_FRPEL;
      CString      m_FASTR;
      CString      m_FASTL;
      CString      m_FOTHR;
      CString      m_FOTHL;
      CString      m_REBY;
      CString      m_RETO;
      CString      m_RETY;
      CString      m_REDR;
      //}}AFX_FIELD

// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CSectionSet)
      public:
      virtual CString GetDefaultConnect();      
             // Default connection string
      virtual CString GetDefaultSQL();       
              // default SQL for Recordset
      virtual void DoFieldExchange(CFieldExchange* pFX);                    // RFX support
      //}}AFX_VIRTUAL

// Implementation
#ifdef _DEBUG
      virtual void AssertValid() const;
      virtual void Dump(CDumpContext& dc) const;
#endif

};


it seems that rs is not connected to the above class????

thanks a lot!
0
inprasCommented:
Oops this means U have done UR project as with database support U should use
CSectionSet rs; to open
even after this also U get error then go to class wizard and choose update fields so that UR recodset rebinfds to UR table I seriously doubt U have those
m_HCATR m_HCATL equivalent fields in UR databse there is always a one to one relation between UR databse fields and UR recordset derived class check whether it is there.
Where is UR email id so that I can send the sample work space for U?
0
greenbirdAuthor Commented:
hi,

my email address is:

aibinbin@hotmail.com
0
greenbirdAuthor Commented:
Hi,Inpras

have u seen my email address? aibinbin@hotmail.com

well i wonder whether u have read my requirements for the program:

click a button on a FormView, then a dialog box is displayed.

in the dialog box, there is a clistbox and a button.
let user select which fields to combine in the clistbox.click the button on the dialog box, then update the database in the following way:

say the database have the following fields:

A1 A2 B1 B2 C1 C2

if (A1="Y" and A1 ="Y")
then delete A1 and A2
       and insert A3 = "Y"
else
    delete A1 and A2
    and insert A3="N"

lets say the user select "combine A1 and A2" in the clistbox, then the database fianlly will be like:

A3 B1 B2 C1 C2

thank u very much again and waiting for ur email!

thanks!
0
greenbirdAuthor Commented:
Hi,Inpras

have u seen my email address? aibinbin@hotmail.com

well i wonder whether u have read my requirements for the program:

click a button on a FormView, then a dialog box is displayed.

in the dialog box, there is a clistbox and a button.
let user select which fields to combine in the clistbox.click the button on the dialog box, then update the database in the following way:

say the database have the following fields:

A1 A2 B1 B2 C1 C2

if (A1="Y" and A1 ="Y")
then delete A1 and A2
       and insert A3 = "Y"
else
    delete A1 and A2
    and insert A3="N"

lets say the user select "combine A1 and A2" in the clistbox, then the database fianlly will be like:

A3 B1 B2 C1 C2

thank u very much again and waiting for ur email!

thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.