[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

TO: Inpras ( in viewing ur reply)

Posted on 2000-01-13
11
Medium Priority
?
209 Views
Last Modified: 2013-11-20
Hi, Inpras,

pls read my new post in the original qn.
thanks a lot!
0
Comment
Question by:greenbird
  • 7
  • 4
11 Comments
 

Author Comment

by:greenbird
ID: 2351604
Edited text of question.
0
 

Author Comment

by:greenbird
ID: 2351605
Edited text of question.
0
 
LVL 4

Accepted Solution

by:
inpras earned 150 total points
ID: 2351768
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
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 

Author Comment

by:greenbird
ID: 2351895
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
 
LVL 4

Expert Comment

by:inpras
ID: 2351963
give me UR email ID I will send U my work space
0
 
LVL 4

Expert Comment

by:inpras
ID: 2351967
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
 

Author Comment

by:greenbird
ID: 2352124
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
 
LVL 4

Expert Comment

by:inpras
ID: 2352211
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
 

Author Comment

by:greenbird
ID: 2352337
hi,

my email address is:

aibinbin@hotmail.com
0
 

Author Comment

by:greenbird
ID: 2352620
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
 

Author Comment

by:greenbird
ID: 2352622
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Suggested Courses

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question