차근차근/C

mysql datetime형식을 mfc에서 cstring으로 변환

예쁜꽃이피었으면 2015. 7. 16. 15:14


검색어 : afxmessagebox format ,date



https://www.gidforums.com/t-17865.html

Hi,


I don't know for sure if I am asking the correct question. Following setup: dialog based MFC application, which connects with a second application via a COM interface.


Say I have defined via the COM interface an Object called item.

I can access several properties of item (price, date, name etc....). For example using item->price (returns float) .


If I get an integer, float, or string I know how to convert to CString to do an output via AfxMessageBox().


But what is returned if I do item->date and how can i display it using a CString (for AfxMessageBox)? Unfortunately the documentation of the com server doesn't say anything. Is there some canonical answer?

There is some type DATE I found via google and I tried the following


DATE d;

d=item->date;

(compiles)

but AfxMessageBox(d); doesn't compile.


I have found some examples for this com server, unfortunately in C#, there the command ToString() is used to convert every property of item.


What can I do? 


Sam - See more at: https://www.gidforums.com/t-17865.html#sthash.9FJInPIz.dpuf








Hi,


thank you for answer. 


COleDateTime codt(item->date);


seems to works. Since I can't use cout I format it to a Cstring:


CString str = codt.Format();


Then I display it with AfxMessageBox(str);


Nice:-)


Thx again - See more at: https://www.gidforums.com/t-17865.html#sthash.9FJInPIz.dpuf



mysql 의 date형식의 데이터를 가져와서

mfc에 list control에 보여주기


COleDateTime codt(m_pSet->m_date);

CString str = codt.Format();

AfxMessageBox(str);


m_List.SetItemText(0, 1, str);



[ db 테이블에 보이는 데이터]



[ mfc실행시 보이는 화면 ]







반응형

'차근차근 > C' 카테고리의 다른 글

MFC 새 레코드 저장하기.  (0) 2015.07.29
OLEDB사용 관련 질문입니다.  (0) 2015.07.27
mfc , oledb , crud  (0) 2015.07.15
mfc / listcontrol / xlistctrl  (0) 2015.07.10
[Tip] MySQL DB를 Visual Studio의 Server Explorer에 추가하기  (0) 2015.07.08