|
That helps a great deal. Thanks!
Mark.
Mark Malin
Software Developer
GE Healthcare
|
|
|
|
|
I'm working on a data processing application where the user selects the data source and relevant fields at runtime. No matter what the source (Access, Excel, MySQL, etc) I am able to retrieve the table names and column information. But for any non-access data source, when I query it, there are no rows returned and the application crashes on my MoveFirst call. Here is the source, and forgive me, this is my first time with ATL:
<br />
CDataSource source;<br />
CSession sess;<br />
<br />
CTable<CDynamicAccessor> rs;<br />
<br />
USES_CONVERSION;<br />
<br />
if(source.OpenFromInitializationString(A2OLE(m_lpFilename))!=S_OK)<br />
return FALSE;<br />
<br />
<br />
if(sess.Open(source)!=S_OK)<br />
{<br />
sess.Close();<br />
source.Close();<br />
<br />
return FALSE;<br />
}<br />
<br />
<br />
CString sSQL="..."<br />
<br />
<br />
rs.Open(sess,sSQL);<br />
<br />
HRESULT hr=rs.MoveFirst();<br />
The debugger asserts on the rowset being NULL, so I take it nothing was returned from the data source but queries run against the database (like in the MySQL console) return rows.
Any idea at all whats going wrong?
Thanks,
Aaron
modified 12-Jul-20 21:01pm.
|
|
|
|
|
CTable doesn't accept an SQL-string as argument, it expects a table name. It could be the case that CTable crashes due to poor error handling. Have you tried with CCommand?
--
LOADING...
|
|
|
|
|
You're right, its not supposed to accept SQL. Very odd that it would in certain cases. Now that I've addressed that, everything is working great. Thanks!
modified 12-Jul-20 21:01pm.
|
|
|
|
|
I want to add Atl New Object to my project And according to theory it sould be present in Insert Menu But that is not present in my vc++6.0 Enter price Edition...
Can anybody help me how to get it
|
|
|
|
|
does answer in VC++ forum doesn't satisfy you?
|
|
|
|
|
hy.
I am write aplication in WinXP on DCOM and i have a lot of problems with it.
My question is : meybe there is samthing else that better that DCOM or samthing that replace DCOM or may be .NET have anything else.
I tred to find any books on DCOM but I can`t find any new books on DCOM. a books that a found them from 1999 and there is nothing on DCOM in WinXP.
please help me.
thanks.
greg
-- modified at 4:42 Sunday 22nd October, 2006
|
|
|
|
|
i recently coded an Empty Hello Projcet using VC6.0.
this project consists of three files:
1 MySimple.cpp
//----------------------------------------
#include "accum3.h"
#include <iostream>
template< typename T >
inline
typename AccumulationTraits< T >::AccT accum(T const* beg, T const* end)
{
return Accum< T >::accum(beg, end);
}
int main()
{
int num[] = {1,2,3,4,5};
accum(&num[0], &num[5]);
return 0;
}
//------------------------------
2 accumtriats.hpp
//-----------------------------
template< typename T >
class AccumulationTraits;
template<>
class AccumulationTraits< char >
{
public:
typedef int AccT;
static AccT zero()
{
return 0;
}
};
template<>
class AccumulationTraits< int >
{
public:
typedef long AccT;
static AccT zero()
{
return 0;
}
};
......
//--------------------------------
3 accum3.hpp
//----------------------------------
#include "accumtraits2.h"
template < typename T ,
typename AT = AccumulationTriats< T > >
class Accum
{
public:
static typename AT::AccT accum(T const* beg, T const* end )
{
typename AT::AccT total = AT::zero();
while( beg != end )
{
total += *beg;
++beg;
}
return total;
}
};
//------------------------
but when i try to complie this project, problems start to arise like fellowing:
"AccT" is not a member of AccumulationTraits
being stuck by this problem for days, i really get
frustrated. Doesn't VC6.0 surpport syntax like this?
template< typename T >
class AccumulationTraits;
template<>
class AccumulationTraits< char >
{
public:
typedef int AccT;
static AccT zero()
{
return 0;
}
};
well, i am all at the sea now
i do define AccT in AccumulationTraits
|
|
|
|
|
I suggest you to post your code in proper format , using pre tags.
|
|
|
|
|
Hello Yaki_15,
Visual C++ 6.0 is not fully STL compliant. VC++ 7.0 -is-.
I compiled your code in VC++ 7.0 with no problems but faced the exact same compilation error that you faced when I did it with VC++ 6.0.
However, I came up with a workaround for you :
try adding this class :
template < typename T >
class return_value
{
public:
typedef AccumulationTraits<t> traits_type;
typedef traits_type::AccT type;
};
then re-declare "accum" as follows :
template< typename T >
inline typename return_value< T >::type accum(T const* beg, T const* end)
{
return Accum< T >::accum(beg, end);
}
The compilation worked this time. The results are the same when I used "accum()" in main().
Best Regards,
Bio.
|
|
|
|
|
Hi, Bio
<I compiled your code in VC++ 7.0 with no problems >
After days' searching for stuff on this, i begin to know that VC++7.0
Surports:
Partial Specialization of class templates
but VC++6.0 doesn't, as well as follow Advanced Features of C++:
1 Out-of-class member template definitions
2 template template parameters
It's said that VC++7.1 or higher is upto 98% conforming to the C++ Standar,so
the featurs we discuss above are well surpported by VC7.1
<try adding this class>
where should i place this class? i need more information like this:
1 in which file
2 at which position(a Forward Declaration?)
I really appreciate your work and help.
best wishes
Yaki
|
|
|
|
|
Hello Yaki_15,
Yes, the issue is that VC++ 6.0 is not fully "Standard C++"-compliant, and not that it is not fully "STL"-compliant. I was wrong there. Thanks for showing me the right info
Best Regards,
Bio.
|
|
|
|
|
<try adding this class>
class return_value
{
public:
typedef AccumulationTraits traits_type;
typedef traits_type::AccT type;
};
I changed your class like this:
class return_value
{
public:
typedef AccumulationTraits< T > traits_type;
typedef traits_type::AccT type;
};
and placed it at the end of file accumulationtrait.hpp
and the program can be complied with no error and run well.
|
|
|
|
|
Hello Yaki_15,
Congratulations on resolving your problem. Strange thing is that I did declare the "traits_type" typedef in "return_value" class as "AccumulationTraits< T >". The "< T >" somehow disappeared when I posted my message.
It's good anyway to see that your code is now working well
Best Regards,
Bio.
|
|
|
|
|
Hi all,
Respected Members,
I want to upload pd's and mp3 files using .net 2003, if any one have idea plz mail to me
My email id: vijayprakash.g@gmail.com
thank you.
Vijayprakash.g
vijayprakash.g
|
|
|
|
|
|
I am a newbie.
I need print a kind of bill , which content some title word and a table . I use a listviewctrl as the container including data.
hte following work is printing them to a bill with their precise position. I can not write the code of printint data with my wtl programme.
how to?
|
|
|
|
|
Scenario:
Using a dll with javascript. The DLL resides in the server, and gets
downloaded into the client's machine as I specify the codebase= in the <OBJECT> tag of the HTML page.
Question:
How do I change the Classid of my component? The problem is that when I make a new version of the component, The client machine doesn't recogonise it as new(as the classid is remains the same as the older one) and hence it doesn't download the
new copy of the dll. So no matter what changes I make in my component, the client machine continues to use the older version of the dll that it downloaded long time ago until I mannually remove it from downloaded programs. Please help.
|
|
|
|
|
Use the #Version=a,b,c,d fragment identifier on the CODEBASE attribute documented here[^] to have the browser download a newer version of the component. You can keep the CLSID the same.
If your new version of the component is not compatible with the older version, you should change the CLSID.
|
|
|
|
|
breakthrough .
|
|
|
|
|
I am using a WTL list control.
when i use the control with records more than 10000, the application gets hanged, and it takes too much time.
Where the same code used with commctrl's listview, i have no problem in adding any number of records.
**************The code snipeet************************
for (DWORD i = 0; i < dwCount; i++) {
LVITEM lvi = {LVIF_TEXT|LVIF_PARAM}; lvi.iItem = i; lvi.lParam = i;
char text[0x8000]; lvi.pszText = text;
//State
lstrcpy(text,pStates[i]);
lvi.iSubItem = 0; lvi.iItem = (int)SendMessage(m_hwndListFiles,LVM_INSERTITEM,NULL,(LPARAM)&lvi);
//Name
WideCharToMultiByte(CP_ACP,0,pwszNameExt[i],-1,text,ARRAYSIZE(text),NULL,NULL);
lvi.iSubItem = 1; lvi.mask = LVIF_TEXT; SendMessage(m_hwndListFiles,LVM_SETITEM,NULL,(LPARAM)&lvi);
//Location
WideCharToMultiByte(CP_ACP,0,pwszLocation[i],-1,text,ARRAYSIZE(text),NULL,NULL);
lvi.iSubItem = 2; SendMessage(m_hwndListFiles,LVM_SETITEM,NULL,(LPARAM)&lvi);
//Size
SizeToStr(text,ullSize[i]);
lvi.iSubItem = 3; SendMessage(m_hwndListFiles,LVM_SETITEM,NULL,(LPARAM)&lvi);
}
*******************************ENd of code******************************
When i use this in project where common controls {commctrl.h} is used, it works in less than a second for 7000 records, but wen used in any VisualStudio Environment with WTL or MFC, it takes more than 100 seconds.
Can you help me on this.
|
|
|
|
|
Hmm.. I find this difference in times boggling. The WTL layer on top of the listview is extremely thin. You can easily verify this by looking at the source code for it. As far as I know, there are no "hooks" in WTL that hijacks the common controls code.
Is the listview control the same control (same code which instantiates it, etc) in all environments? If you are hosting a listview control in a WTL container window, it might have REFLECT_NOTIFICATIONS() in its message map. That would probably generate a lot of unnecessary callbacks to the listview control. If you are subclassing the listview, that too will add a small overhead (but nowhere near what you describe - unless the subclassed window's wndproc is fubared).
I have had the misfortune of loading 500+ items in a listview in an MFC project. The loading time is closer to 1 second than 100 seconds (maybe 2-5 if the database is congested). And that is on < 1 Ghz hardware.
May I ask where you get the data from? If it is already residing in memory, I would suggest to use a different strategy for displaying the data by using the LVS_OWNERDATA feature of the listview. It's slightly slower in repaints (not noticeable by the average user, but if you've lived and breathed CListCtrl for half a lifetime you'll notice it ), but is MUCH faster in initialization and destruction.
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|
|
I have implement IContextMenu::QueryContextMenu() and IObjectWithSite::SetSite() interface in Pocket IE.I want to get the URL when I right click a hyperlink,but I do not know how to implement this.Anybody can teach me??Anybody can help me??please!
Thanks a lot.I apologize for my bad English.
-- modified at 5:48 Tuesday 10th October, 2006
|
|
|
|
|
I am using WTL75 with Visual Studio 2005.
I have created all the UI controils and it works fine.
But in XP when when Windows XP theme is enabled the button is getting hidden. At an initial stage if we set the focus on to the button (by pressing tab or alt keys) it shows, but after that it never gets displayed.
Even if it is displayed, once when the parent window loses the focus and it retains the focus, the buttons are getting reased again.
Can anyone help me on this.
|
|
|
|
|
I use the following code to draw an icon on the Window.
HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_HELP), IMAGE_ICON, m_nButtonWidth, m_nButtonHeight , LR_DEFAULTCOLOR);
<br />
::DrawIconEx(hDC, 2, 2, hIcon, m_nButtonWidth, m_nButtonHeight, 0, NULL, DI_NORMAL);
This draws the icon on the Window. But my problem is that my window has a gradient background and my icon has a white background so when I draw the icon, the square shape of the icon with the white background is visible. I want to make the white portion of the icon transparent so that my Window background is visible. How do I do it?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
|
|
|
|
|