Click here to Skip to main content
15,891,704 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Peeking into the message queue of another thread Pin
Phil.Benson28-Jun-06 1:36
professionalPhil.Benson28-Jun-06 1:36 
GeneralRe: Peeking into the message queue of another thread [modified] Pin
Justin Tay28-Jun-06 2:39
Justin Tay28-Jun-06 2:39 
GeneralRe: Peeking into the message queue of another thread Pin
Phil.Benson28-Jun-06 2:54
professionalPhil.Benson28-Jun-06 2:54 
GeneralRe: Peeking into the message queue of another thread [modified] Pin
Justin Tay28-Jun-06 3:02
Justin Tay28-Jun-06 3:02 
GeneralRe: Peeking into the message queue of another thread Pin
Phil.Benson28-Jun-06 3:29
professionalPhil.Benson28-Jun-06 3:29 
GeneralRe: Peeking into the message queue of another thread Pin
Justin Tay28-Jun-06 3:38
Justin Tay28-Jun-06 3:38 
GeneralRe: Peeking into the message queue of another thread Pin
Phil.Benson28-Jun-06 5:33
professionalPhil.Benson28-Jun-06 5:33 
QuestionDatabase error in C++ Pin
aSoundMind27-Jun-06 23:29
aSoundMind27-Jun-06 23:29 
Hi this is my first post in this forum. I am having problem with a portion of codes in C++. Hope you guys can help me solve this matter. Sorry if it's too long and also my terrible English. Thank you all in advance.

I have a function ValidateInvCtnReturn() which process the invoice inputted by user and return AE. The function is retriving few data from inv_lot table which are invoiceNo, cartonNo, ReturnStatus and few more.

Depending on the input, there are 4 posibilites of AE being returned which are:
- AE_NOINVOICE => The invoice is not found in the database
- AE_DUPLICATERC => The invoice has a RC status in ReturnStatus field
- AE_DUPLICATERA => The invoice has a RA status in ReturnStatus field
- AE_NOERROR => The invoice has passed all the checkings and no error

I have tried several attempts on retrieving the table.
___________________________________________________________
1. Input a non-existing invoice, existing invoice with RC status, existing invoice with RA status
Result: As expected, program returns AE_NOINVOICE, AE_DUPLICATERC, AE_DUPLICATERA in order successfuly.

2. Input an existing invoice with no returnstatus (returnStatus field is NULL in database)
Result: I am expecting the program to prompt me the "SUCCESS" message. Instead it prompts database error, which is a default error message whenever there is a problem with the database.


Following is the code calling ValidateInvCtnReturn() function:

if(ValidateInvCtnReturn(invoiceStr)!=AE_NOERROR){
DisplayMessage("No error");
}else{
DisplayMessage("SUCCESS");
}


//The ValidateInvCtnReturn() function

int ValidateInvCtnReturn(const char* invoiceNo)
{
//DisplayStatus("Validate Invoice");
char sourceStr[SRC_LEN+1];
int ae = AE_NOERROR;
HRESULT hr = S_OK;
ADODB::_RecordsetPtr Rs = NULL;

ostrstream osSrc(sourceStr,sizeof(sourceStr));
osSrc << "SELECT InvoiceNo, cartonNo, ReturnStatus FROM inv_lot "
<< "WHERE InvoiceNo='" << invoiceNo << "' AND "
//<< "CartonNo ='" << CartonNo << "' AND "
<< "DivCode='" << gDC << "' AND "
<< "FactCode='" << gFC << "'"
<< ends;

_bstr_t Connect( gConnectStr );
_bstr_t Source ( sourceStr );

try{
TESTHR(hr = Rs.CreateInstance( __uuidof( ADODB::Recordset )));
Rs->Open( Source, Connect, ADODB::adOpenForwardOnly, ADODB::adLockReadOnly, ADODB::adCmdText);


if (Rs->BOF){ // no records returned
DisplayMessage(GetAppError(ae = AE_NOINVOICE));
// ae = AE_NOINVOICE;
// DisplayMessage("No Invoice");
}
else if (stricmp(((char*)(_bstr_t)Rs->Fields->Item["ReturnStatus"]->Value),"RC") ==0){
DisplayMessage(GetAppError(ae = AE_DUPLICATERC));
// ae = AE_DUPLICATERC;
// DisplayMessage("Duplicate RC");
}
else if (stricmp(((char*)(_bstr_t)Rs->Fields->Item["ReturnStatus"]->Value),"RA") ==0){
DisplayMessage(GetAppError(ae = AE_DUPLICATERA));
// ae = AE_DUPLICATERA;
// DisplayMessage("Duplicate RA");
}
else if ((Rs->Fields->Item["ReturnStatus"]->Value.vt == VT_NULL) ==0){
DisplayMessage(GetAppError(ae = AE_NOERROR));
ae = AE_NOERROR;
DisplayMessage("NULLY");
}

Rs->Close();
Rs = NULL;
}
catch (_com_error &e )
{
ae=AE_DBERROR;
DisplayComError(e);
}

return ae;
}
Questionanother kind of linker error Pin
Desmo1627-Jun-06 23:25
Desmo1627-Jun-06 23:25 
AnswerRe: another kind of linker error Pin
_AnsHUMAN_ 27-Jun-06 23:28
_AnsHUMAN_ 27-Jun-06 23:28 
AnswerRe: another kind of linker error Pin
Cedric Moonen27-Jun-06 23:33
Cedric Moonen27-Jun-06 23:33 
AnswerRe: another kind of linker error Pin
Sarath C27-Jun-06 23:41
Sarath C27-Jun-06 23:41 
QuestionMessageBox French Pin
dungpapai27-Jun-06 23:04
dungpapai27-Jun-06 23:04 
AnswerRe: MessageBox French Pin
Cedric Moonen27-Jun-06 23:21
Cedric Moonen27-Jun-06 23:21 
AnswerRe: MessageBox French Pin
Sarath C27-Jun-06 23:26
Sarath C27-Jun-06 23:26 
AnswerRe: MessageBox French Pin
FarPointer27-Jun-06 23:26
FarPointer27-Jun-06 23:26 
QuestionHTML Help Workshop from the Command Line [modified] Pin
Joel Holdsworth27-Jun-06 22:35
Joel Holdsworth27-Jun-06 22:35 
AnswerRe: HTML Help Workshop from the Command Line Pin
Sarath C28-Jun-06 1:07
Sarath C28-Jun-06 1:07 
QuestionRe: HTML Help Workshop from the Command Line [modified] Pin
Joel Holdsworth28-Jun-06 2:31
Joel Holdsworth28-Jun-06 2:31 
AnswerRe: HTML Help Workshop from the Command Line Pin
S Douglas28-Jun-06 12:03
professionalS Douglas28-Jun-06 12:03 
GeneralRe: HTML Help Workshop from the Command Line Pin
Joel Holdsworth28-Jun-06 12:20
Joel Holdsworth28-Jun-06 12:20 
GeneralRe: HTML Help Workshop from the Command Line Pin
S Douglas28-Jun-06 12:29
professionalS Douglas28-Jun-06 12:29 
Questionhow to get rid of this linker erroe Pin
GANsJob27-Jun-06 22:31
GANsJob27-Jun-06 22:31 
AnswerRe: how to get rid of this linker erroe Pin
Cedric Moonen27-Jun-06 22:34
Cedric Moonen27-Jun-06 22:34 
GeneralRe: how to get rid of this linker erroe Pin
GANsJob27-Jun-06 22:38
GANsJob27-Jun-06 22:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.