|
|
And your question is?!
Oh, and by the way, if you do ask a question, don't just post a link to your complete project - post the code fragment you're having trouble with!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
What the hell is wrong with you? You've been posting this mindless drivel for a while now. Your employer has my sympathy.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi all,
In vista explorer when we copy any ".eml" file it shows all values of that email in its column,like From address,To address,From name,Subject etc..
But it is not displaying same for Outlook office email message (.Msg)File.
Can anybody tell why its not displaying this.Is that possible to show this fields in vista
explorer columns?
If yes How?
Is there any registry setting?
Thanx in advance.
-Jay
|
|
|
|
|
void CSimpdbView::OnRecordsInsert()
{
CSimpdbDoc* pDoc = GetDocument();
_CommandPtr pCmd = NULL;
pCmd.CreateInstance(__uuidof(Command));
//Disables window once data entering is finished.
CEdit* ePtr = (CEdit*)GetDlgItem(IDC_ISBN);
ePtr->EnableWindow(FALSE);
ePtr = (CEdit*)GetDlgItem(IDC_NAME);
ePtr->EnableWindow(FALSE);
ePtr = (CEdit*)GetDlgItem(IDC_PAGES);
ePtr->EnableWindow(FALSE);
ePtr = (CEdit*)GetDlgItem(IDC_EDITION);
ePtr->EnableWindow(FALSE);
ePtr = (CEdit*)GetDlgItem(IDC_AUTHOR);
ePtr->EnableWindow(FALSE);
//Saves data from edit box in respective variables.
CString strIsbn,strName,strPages,strEdition,strAuthor;
ePtr = (CEdit*)GetDlgItem(IDC_ISBN);
ePtr->GetWindowText(strIsbn);
ePtr = (CEdit*)GetDlgItem(IDC_NAME);
ePtr->GetWindowText(strName);
ePtr = (CEdit*)GetDlgItem(IDC_PAGES);
ePtr->GetWindowText(strPages);
ePtr = (CEdit*)GetDlgItem(IDC_EDITION);
ePtr->GetWindowText(strEdition);
ePtr = (CEdit*)GetDlgItem(IDC_AUTHOR);
ePtr->GetWindowText(strAuthor);
//Database code.
_bstr_t sqlQuery("Insert into lib_book_details values(?,?,?,?,?)");
pCmd->ActiveConnection = pDoc->m_pConnection;
pCmd->CommandText=sqlQuery;
try
{
pCmd->CreateParameter("strIsbn",adVarChar,adParamInput,sizeof(char),vtMissing);
pCmd->CreateParameter("strName",adVarChar,adParamInput,sizeof(char),vtMissing);
pCmd->CreateParameter("strPages",adVarChar,adParamInput,sizeof(char),vtMissing);
pCmd->CreateParameter("strEdition",adVarChar,adParamInput,sizeof(char),vtMissing);
pCmd->CreateParameter("strAuthor",adVarChar,adParamInput,sizeof(char),vtMissing);
pCmd->Parameters->Append((_variant_t)strIsbn); //GOES INTO THE CATCH BLOCK FROM HERE.
pCmd->Parameters->Append((_variant_t)strName);
pCmd->Parameters->Append((_variant_t)strPages);
pCmd->Parameters->Append((_variant_t)strEdition);
pCmd->Parameters->Append((_variant_t)strAuthor);
pCmd->Execute(NULL,NULL,adCmdText);
MessageBox("Record Inserted.",NULL,MB_OK);
}
catch(_com_error &e)
{
TRACE( "Error:%08lx.\n", e.Error());
TRACE( "ErrorMessage:%s.\n", e.ErrorMessage());
TRACE( "Source:%s.\n", (LPCTSTR) _bstr_t(e.Source()));
TRACE( "Description:%s.\n", (LPCTSTR)_bstr_t(e.Description()));
}
catch(...)
{
TRACE("**********Unhandled Exception*********");
}
}
I m trying to execute the above code .But the code above does not insert the data into database.What is wrong with the code.It executes the catch block from the statetment ::
pCmd->Parameters->Append((_variant_t)strIsbn);
I would appreciate the help .I have used this website http://support.microsoft.com/default.aspx/kb/181734[^]"> as reference.
modified on Friday, May 22, 2009 9:06 AM
|
|
|
|
|
And what is the output of the catch block?
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]
|
|
|
|
|
I do not see anything displayed in the window as error!!!...but when i debug using a brkpt and then F10 i see the catch being executed.How do i see the error thrown ??Kindly help me here.
|
|
|
|
|
vital_parsley2000 wrote: How do i see the error thrown
Look in Visual Studio's Output window (you may need to make it visible from the View menu). That's where TRACE output goes.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I tried adding the following line to the catch block.
AfxMessageBox(_com_error(GetLastError()).ErrorMessage(),MB_ICONSTOP);
And i get the following on the message box.
"The operation completed successfully."
But this doesnt seem to be an error. does it !!!?
Otherwise Trace returns the following :
Exception:
First-chance exception in simpdb.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
Error:80020005.
ErrorMessage:Type mismatch..
Source:(null).
Description:(null).
|
|
|
|
|
vital_parsley2000 wrote: Error:80020005.
ErrorMessage:Type mismatch..
Hmmm - what does that tell us.... Type mismatch So, what type are involved? 1) The column types, 2) the declared parameter types, 3) the value you pass for the parameter. Let's examine your first parameter:
pCmd->CreateParameter("strIsbn",adVarChar,adParamInput,sizeof(char),vtMissing);
Column type? Don't know, you haven't told us.
Parameter type? VARCHAR - but you've specified a maximum length of 1 (the sizeof(char) bit)
Value? well, immediately vtMissing, but later you assign it with
pCmd->Parameters->Append((_variant_t)strIsbn);
All looks well ...except that if strIsbn is a string containing more than one character, it's incompatible with the parameter, and (I suspect) you have a type mis-match.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
OK - my previous answer was right, but also wrong. Your current error is because you're using CreateParameter and Append wrong. Look at this example for CreateParameter and Append[^]. You have to create the parameter and append it, then set its value.
So, you need code like this:
_ParameterPtr p = pCmd->CreateParameter("strIsbn",adVarChar,adParamInput,sizeof(char),vtMissing);
pCmd->Parameters->Append(p);
p->Value = variant_t("test value");
HOWEVER - this will throw an exception when you assign the value, because you've said the parameter is a VARCHAR(1). Change the sizeof(char) to the actual length of the VARCHAR column as defined in the database schema and you've got a chance of the code working!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanx a lot for ur replies.
|
|
|
|
|
If you compare your code with the article content, then you may find:
vital_parsley2000 wrote: pCmd->CreateParameter("strIsbn",adVarChar,adParamInput,sizeof(char),vtMissing);
should possibly be
paramIsbn = pCmd->CreateParameter("strIsbn",adVarChar,adParamInput,-1,vtMissing);
Where paramIsbn must be declared as _ParameterPtr
Moreover you should replace
vital_parsley2000 wrote: pCmd->Parameters->Append((_variant_t)strIsbn);
with something like this
paramIsbn->Value = _variant_t( strIsbn );
pCmd->Parameters->Append(paramIsbn);
The same for all the other parameters
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]
|
|
|
|
|
Thanx alot .Your changes worked!
One last thing regarding the error;When i use GetLastError() the message it returns is which error.Because when i used GetLastError()i got the message Operation completed successfully.What did it mean ?
|
|
|
|
|
GetLastError should be called immediately after a function failure, otherwise it may reports success because the last operation was indeed executed successfully (i.e. other function calls overwrite the last error value).
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]
|
|
|
|
|
Thx for ur reply.Appreciate your help.
The code above i have ,i would like to know if its open for sql injection ?
How do i avoid it ? it is open for sql injection.
i have read some articles on sql injections and have understood that parameterized values could be injected for malicious values.
So,would like to know if it is open for sql injection ?
|
|
|
|
|
vital_parsley2000 wrote: The code above i have ,i would like to know if its open for sql injection ?
I don't believe so - SQL injection occurs when you build the query/command string embedding the parameter values explicitly - the classic example (in comic form) is this one[^]
In fact, if you look at the Wikipedia entry for SQL injection[^], they explicitly mention parameterised queries (like you have here) as a mechanism for avoiding SQL injection.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you for your reply.
|
|
|
|
|
Hi all,
please help on debug assert error while using domodal().
CDeleteJed d(this);
d.DoModal();
when i debug i found assert as followed
VERIFY(RunModalLoop(dwFlags) == m_nModalResult);
ASSERT(ContinueModal());
if (!AfxPumpMessage()) {
AfxPostQuitMessage(0);
return -1;
}
=>
BOOL AFXAPI AfxPumpMessage()
{
CWinThread *pThread = AfxGetThread();
if( pThread )
return pThread->PumpMessage();
else
return AfxInternalPumpMessage();
}
debug assertion failed . please help
Thanks in adv.
|
|
|
|
|
I think the problem is in this line.
CDeleteJed d(this);
Dont pass "this" to the constructor.
Just check it.
It should work fine.
Thanks,
Sujeet
|
|
|
|
|
thanks for reply.I use without "this" key but result is same..
|
|
|
|
|
I developing a SDI based application. the VIEW area have some rectangle and text messages the problem here is that when i maximize the VIEW area every thing in the view area disturbed and misplaced. can anyone help me solving this problem, that when i maximize the application the every thing in the VIEW area maximize accordingly.
Thanks
kkkljj
|
|
|
|
|
You need to resize the rectangle and text messages according to window resized when its maximized.
chk this.ResizableFormView[^]
and CResizableFormView[^]
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
I want to create a local webservice and pass soap message from a browser to this webservice.
i.e. lets say i have opened one web page in my browser. On clicking of one button in browser, i want to pass a soap message to a locally created webservice in vc++.
Can anyone help how to do this?
Thanks,
Sujeet Kumbhar
|
|
|
|
|
You have to use INET api to do so! read more about it in your local copy of MSDN.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|