|
Deepu Antony wrote: In this process when i==3,in that particular location in my database(row==264),it is skipping without updating and is moving to the next row.
So does Update() throw an (CDBException ) exception?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks for the reply.
it is working now.I didn't changed anything.Sometimes it happens like that.
Don't know the exact reason
|
|
|
|
|
Hi!
I need help with this problem, I got this error before but I managed to solve.
But now I have a case with the virtual function.
The source looks like this(after the code I continued writing):
#include "stdafx.h"
#ifndef EMPTRANSH
#define EMPTRANSH
#include "Global.h"
#include "iostream"
#include "string"
using namespace std;
class EmpTrans
{
private:
int id;
char emp_name[MAXNAMELENGTH];
employee_status emp_st;
int salary;
salary_type sal_st;
char deal_date[DATELENGTH];
public:
EmpTrans();
static void Open();
static void Close();
void ReadNext();
virtual void Apply();
void UpdateId(int i){id = i;}
void UpdateSalary(int s){salary = s;}
void UpdateEmployeeStatus(employee_status es){emp_st = es;}
void UpdateSalaryType(salary_type ss){sal_st = ss;}
void UpdateDate(char * d){strcpy(deal_date,d);}
void UpdateEmployeeName(char en){emp_name[0] = en;}
int GetId(){return id;}
char * GetEmployeeName(){return emp_name;}
employee_status GetEmployeeStatus(){return emp_st;}
int GetSalary(){return salary;}
salary_type GetSalaryType(){return sal_st;}
char * GetDate(){return deal_date;}
};
#endif
class EmpTransAdd : public EmpTrans
{
public:
void Apply();
};
class EmpTransChange : public EmpTrans
{
public:
void Apply();
};
class EmpTransDelete : public EmpTrans
{
public:
void Apply();
};
When I compile and link this source I get the error,
when I remove the virtaul function from the Apply function, everything works fine.
What is the problem?
Do I need to take out the other classes from the source? or to include them inside the ifdef?
Thanks
|
|
|
|
|
You don't provide a body for the EmpTrans::Open(), EmpTrans::Close(), EmpTrans::Apply functions (well at least you didn't show us). You still need to provide a body for those functions in the base class, unless they are pure virtual functions (e.g. virtual void Apply() = 0; ), in which case it is mandatory that each child classes implement this function.
|
|
|
|
|
Will u pls show the code which creates the instance of ur class EmpTrans?
you have to provide the definition of Apply() in the base class. else it have to be a pure virtual function.
modified on Tuesday, March 24, 2009 6:44 AM
|
|
|
|
|
if you do not have implementation for virtual void Apply() in class EmpTrans, you should make it.
virtual void Apply()=0 A pure virtual function,
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
hi guys,
i am developing a worm scanner..
i have to choose the directories from Folder Browser Dialog..
when i does that i will get the directory C:\NVIDIA\Win2KXP
but i need to convert it to C:\\NVIDIA\\Win2KXP so that i can get the file names in the that directory using ListFiles......
since the symbol \ i could not put \ between "" and ''
how can i solve this ya??
help me plz...
|
|
|
|
|
Thilek wrote: but i need to convert it to C:\\NVIDIA\\Win2KXP so that i can get the file names in the that directory using ListFiles......
You don't need to convert it. You can use them straight. Only when you hard-code, you'll have to do this. Your question is slightly blurred to me though.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
when i use C:\Private_Folder\forGetz its not seaching or getting the file name.. unless i use C:\\Private_Folder\\forGetz or C://Private_Folder//forGetz then its working
but when i use folder browser dialog , i will be getting as C:\Private_Folder\forGetz....
|
|
|
|
|
Are you using std::string to hold the value?
Maxwell Chen
|
|
|
|
|
|
Thilek wrote: when i use C:\Private_Folder\forGetz its not seaching or getting the file name.. unless i use C:\\Private_Folder\\forGetz or C://Private_Folder//forGetz then its working
Because those are string literals, which must contain double backslahes.
Thilek wrote: but when i use folder browser dialog , i will be getting as C:\Private_Folder\forGetz....
Which is correct.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
You must understand the difference between the hardcoded "\\" and thr "\" in the value of the variable.
"\\": is an so calles 'escape sequence' FOR representing the "\" in the string. Look in the values of strings int the debugger
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
|
its so funny that i been breaking my head for days with this... thanks a lot.. u saved me...
|
|
|
|
|
I am trying to write a simple callback function for my own purpose, not to pass into Windows API as callback arguments. What I did below gets access violation. Where did I do wrong in the below code? Thanks.
typedef void (*fC)(int* p);
bool Test(int n, fC* p)
{
int* pN = new int;
*pN = 3;
(*p)(pN);
delete pN;
return true;
}
void fc(int* p)
{
*p;
}
void main()
{
Test(3, (fC*)&fc);
}
Maxwell Chen
|
|
|
|
|
change
bool Test(int n, fC* p)
to
bool Test(int n, fC p)
Also remove the cast.
void main()
{
Test(3, (fC*) &fc);
}
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Ooops! My bad ...
Maxwell Chen
|
|
|
|
|
|
Maxwell Chen wrote: bool Test(int n, fC* p)
Change to
bool Test(int n, fC p)
Maxwell Chen wrote: Test(3, (fC*)&fc);
Change to
Test(3, fc);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks!
Maxwell Chen
|
|
|
|
|
I've been looking at callback stuff of my own, and if you your code to:
typedef void (*fC)(int* p);
bool Test(int n, fC p)
{
int* pN = new int;
*pN = 3;
(p)(pN);
delete pN;
return true;
}
void fc(int* p)
{
*p;
}
void main()
{
Test(3, (fC)fc);
}
Then it works just fine...
But your code doesn't look bad to me. Just more indirection than you need. fC is already a type of "pointer to a function", so why make things work with "pointer to a pointer to a function"?
In the interests of science, I added these two lines to main:
fC p0 = fc;
fC *p1 = &fc;
And on the second line I get: "error C2440: 'initializing' : cannot convert from 'void (__cdecl *)(int *)' to 'void (__cdecl ** )(int *)'".
This leads me to suggest that you're seeing the same behaviour as when you try to get a pointer to an array - you get the first element of the array back. This is probably a C thing that's biting you. And then you manually cast it in your original main and things blow up later...
That's my theory, anyway!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Thanks!
Maxwell Chen
|
|
|
|
|
Iain Clarke wrote: In the interests of science
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I want to create one email notification application for outlook express 6.
i used "MAPIFindNext()" function to get whether unread messages are present inbox.
this function returns first unread messages id.
but i need to find number of unread messages. Is there any function to find that?
Thanks.
|
|
|
|