|
I try to open a table "Customer" and select a specific record of it with the Open property as follows:
m_pSet->Open(CCustomer::dynaset,"SELECT NAME FROM CUSTOMER WHERE ID = 5"
This command throws the following exception error:
"Invalid character value for cast specification"
Does anyone know what have I done wrong and how to make it work properly?
Thanks in advance
|
|
|
|
|
Did you try m_pSet->Open(CRecordSet::dynaset,_T("SELECT NAME FROM CUSTOMER WHERE ID = 5")) ?
The great error of nearly all studies of war has been to consider war as an episode in foreign policies, when it is an act of interior politics - Simone Weil
Fold with us! ¤ flickr
|
|
|
|
|
Yes I already tried it.
I saw that this was because in the DoFiledExchange() the first field must be of the same type with the requested one in the Select clause.
Thanks very much for your time!
Any idea?
|
|
|
|
|
|
OK I found why this error occured.
This was because in the DoFieldExchanged() I have all the fields of the table, so the Open() should be with NULL value at the second argument (LPCTSTR lpszSQL=NULL).
So, I tried the following:
m_pSet = new CDatabaseSet;
m_pSet->m_strFilter = "ID = 48";
m_pSet->Open(CDatabaseSet::dynaset);
Now the problem is that it works properly when the filter has a field of numeric type.
When it is of character type it doesn't work properly.
It returns the last record even if it shouldn't return anything.
Any idea on why this happens???
Thanks again for your help!!!
|
|
|
|
|
I need to check the security permissions over a folder(which means i need to iterate over the ACE's from the DACL)and check whether the logged in user has some permissions over them.
Heres how i approached this problem -
1)I am using GetFileSecurity() function to get the Security descriptor for
this folder.
2)Next i check whether this descriptor is valid using IsValidSecurityDescriptor().It returns TRUE.
3)Next, i am using the function GetSecurityDescriptorDacl() to get the DACL.
4)The second parameter to this function is an out parameter (a pointer to a bool)which is set to TRUE if DACL is present.
IT is here that in this out parameter i am getting a FALSE value.
What does this imply(coz right clikin the folder to retrieve the security permissions i can get a DACL)
please help
Anmol
-- modified at 7:44 Friday 7th October, 2005
|
|
|
|
|
hi!
i am working on an MFC SDI Application. I have an EditBox on a dialog for dispalying path of files. I hav also used a Button for browsing files.
My Browse button is working , but, i also want that "the path of the file can be entered directly into the edit box." How to do it?
But, I had not used EditBox earlier as i am new to mfc programming. can anybody help me at this issue.
Thanx for providing me help
|
|
|
|
|
CString strPath<br />
GetDlgItemText(IDC_EDIT_PATH, strPath);<br />
P.
|
|
|
|
|
use CWnd::SetWindowText(CString) for this:
((CEdit*)GetDlgItem(IDC_MY_EDIT))->SetWindowText(strFileName);
((CEdit*)GetDlgItem(IDC_MY_EDIT))->GetWindowText(strFileName);
or
m_MyEdit.SetWindowText(strFileName);
m_MyEdit.GetWindowText(strFileName);
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
swaapu wrote:
But, I had not used EditBox earlier as i am new to mfc programming. can anybody help me at this issue.
Thanx for providing me help
Using ClassWizard(Ctrl + W ) associate a CString Variable with the Edit Box.. When ever you need the value from the Edit Box
From Edit Box
UpdateData(<code>TRUE</code>);
MessageBox( m_strEditBox,"Data in Edit Box");
TO Edit Box
m_strEditBox="codeproject";
UpdateData(<code>FALSE</code>);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
How can I play swf (flash) file in VC/MFC without the help of standard flash player?
Is there any library available?
- NS -
|
|
|
|
|
It is possible if you wish to use the ActiveX that Macromedia provides you with ::- ). I did this plenty of times with success in Visual Basic and C#. I will write an article about this perhaps if I'll have time, unfortunately, my time is quite scarce.
You can find the ActiveX on your computer in WINDIR\System32\Macromed\Flash\Flash.ocx. I don't know how to include ActiveXes in Visual C++ but I'm sure that the gurus around here can tell you about that. After you include the ActiveX, you can use its properties and methods to play any kind of Flash in your application. The nice part is that you can even communicate with Flash!! You can send data to Flash or receive from Flash. Just inspect the ActiveX's methods and the documentation by Macromedia.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Can anyone tell me the best way
to use the serialport in MFC
application.
If anyone has used and tested any
class then it will me more helpfull
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
|
Thank you
hope my problem is solved
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hello again guys.
As my project is almost finish, I have few bugs and some display problems.
As I created a SDI CHtmlView base class in MFC/VC++. When the application is launched, it works fine. When I select a new IE window or any other window application on top of my project's application and then click the scroll bar from my project's application, my project displayed white background from the remnant of the other window application. I don't know why this is happens. I don't know if it can be fix in program or Windows problem or what?. It only happens when clicking the scroll bar of my project's application that is behind of other window application. If I only click any part of my project's window, that behavior didn't occur. Any idea why this behaviors happen? I tried googling this behavior but can't find any related topic with this.
With great power comes a great responsibility.
|
|
|
|
|
To be sure all the window is added to the clipping region, you could invalidate all the window (using CWnd::InvalidateRect(NULL) ) when it gets the focus, or when the scrolling is activated.
The great error of nearly all studies of war has been to consider war as an episode in foreign policies, when it is an act of interior politics - Simone Weil
Fold with us! ¤ flickr
|
|
|
|
|
Thanks for your reply.
However, I'm just a newbie with MFC, may I ask how can I do that?
or where part in my code do I put that CWnd::InvalidateRect(NULL)?
Sorry for asking more.
Thanks a lot.
With great power comes a great responsibility.
|
|
|
|
|
You could do this by catching the messages WM_HSCROLL and WM_VSCROLL
<code>
void CMyView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
InvalidateRect(NULL);
<CBaseView>::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CMyView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
InvalidateRect(NULL);
<CBaseView>::OnVScroll(nSBCode, nPos, pScrollBar);
}
Replace CBaseView by the name of the base class view you use (CHtlmView I presume)
This code will ensure all the window will be marked as to be redrawn.
Hope this work
K.
The great error of nearly all studies of war has been to consider war as an episode in foreign policies, when it is an act of interior politics - Simone Weil
Fold with us! ¤ flickr
|
|
|
|
|
Thanks again.
I tried your code, but still there's a white remnant when I click the scroll bar. I just delete the '::' from OnVScroll and OnHScroll in order not to catch an error upon compiling. .
Ok, I get a handle for WM_HSCROLL and WM_VSCROLL in PreTranslateMessage(MSG* pMsg). I don't know what attributes will I put in OnVScroll(..) and OnHScroll(..).
With great power comes a great responsibility.
-- modified at 11:04 Friday 7th October, 2005
|
|
|
|
|
Ok, as you suggested using InvalidateRect(NULL) and as I read from microsoft's site, here's what I did on my project.
At my CMyProjectView.cpp, I made this.
void CMyProjectView.cpp::OnUpdate()
{
InvalidateRect(NULL);
return;
}
but nothing's happened when I run again my project.
With great power comes a great responsibility.
|
|
|
|
|
Hello again people ::- ). My troubles with the MFC radio buttons aren't over. Even though I think I did everything right, something still doesn't work. I put 5 radio buttons and selected the "GROUP" flag only for one of them, as this should be done. Then, to that one radio button, I mapped an m_iSelected member variable using the Class Wizard. The Class Wizard naturally initializes this to -1 and as far as I understood, when the user selects another radio button, in this m_iSelected there should be the index of the selected radio button. If I select the 3rd radio, its value should be 2. Well, it's still -1 no matter what I do. Any idea what's the problem? Thanks ::- ).
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Well, this behaviour is by design.
When you use ClassWizard to add such a variable you let the value of the variable to be updated when DoDataExchange is called. Call UpdateData and m_iSelected is updated since the framework will call DoDataExchange for you.
Perhaps you want to use ON_COMMAND_RANGE instead to have a message handler to be called when you click one of the radio buttons and update your variable in the message handler not using DDX.
Hope this helps
--
Roger
|
|
|
|
|
Of course it shows unchanged
Make a call to UpdateData(TRUE)
before useng the value of m_iSelected.
SkyWalker
|
|
|
|
|
Thanks Roger Stoltz & Mircea Puiu. It works now. Hooray.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|