|
hi all,
i am trying to run a query like this ----
CDatabase database;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = "c:\\MDD.mdb";
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",sDriver,sFile);
TRY
{
database.Open(NULL,false,false,sDsn);
}
CATCH(CDBException, e)
{
}
END_CATCH
database.ExecuteSQL("SELECT MAX(dist) INTO temp FROM TempTable");
***********************************************************************
TempTable is a dynamically generated temporary table.My problem is that i need to get the result of the above query into a variable.
any help to solve this problem will be appreciated....
Thanks and regards.
|
|
|
|
|
vcseeker wrote:
database.ExecuteSQL("SELECT MAX(dist) INTO temp FROM TempTable");
Probably, in your query, you don't want to mean "INTO temp", you want to mean "AS TEMP".
"INTO temp" creates a temporary table and does not return any record.
"AS temp" names the column MAX(dist) as "temp".
ORACLE One Real A$#h%le Called Lary Ellison
|
|
|
|
|
hi Daniel,
Thanks for quick reply.
Actuall i am running the Query--
database.ExecuteSQL("SELECT MAX(dist) FROM TempTable");
and i want to get the result in a local variable that is declared inside my function .I want to assign the value of MAX(dist) into this local vaiable.
something like this...
int local;
local = database.ExecuteSQL("SELECT MAX(dist) FROM TempTable");//I Wish i could be able to do that.
Can you help me in achieving this.
Regards.
|
|
|
|
|
Just a suggestion: perhaps use the CRecordset class to navigate and getting data from your records. Take a look at the MSDN documentation.
Hope this helps.
|
|
|
|
|
Thanks all,i solved the problem using CRecordset.
|
|
|
|
|
Hi all,
I need to know about any Windows API using I can change the network configuration e.g.
IP Address
Subnet Mask
Default Gateway
etc.
of a particular NIC on my machine.
Any help is apreciated
thanks
|
|
|
|
|
hi!
i want to develop file filters for win2k.
i have installed win2k ddk.
i am using visual c++6.0 Enterprise Edition
i tried to run samples provided with the ddk.
/src/storage/filters/diskperf
when i compiled it i got 102 erros,just pasting a couple:
c:\ntddk\inc\ddk\ntddk.h(370) : error C2061: syntax error : identifier 'PULONG_PTR'
c:\ntddk\inc\ddk\ntddk.h(371) : error C2059: syntax error : '}'
c:\ntddk\inc\ddk\ntddk.h(824) : error C2061: syntax error : identifier 'KSPIN_LOCK'
c:\ntddk\inc\ddk\ntddk.h(824) : error C2059: syntax error : ';'
c:\ntddk\inc\ddk\ntddk.h(825) : error C2143: syntax error : missing '{' before '*'
c:\ntddk\inc\ddk\ntddk.h(3654) : error C2061: syntax error : identifier 'ULONG_PTR'
so i traced back the definitions of 'PULONG_PTR',
'ULONG_PTR' etc.. those are defined in basetsd.h
basetsd.h is included in ntdef.h which is inturn included in ntddk.h, for which we are getting the errors.
there are 2 versions of basetsd.h on my system
one provided by ms-visual studio and the other is provided by win2k ddk.
the basetsd.h provided by win2k ddk has the definitions of the 'PULONG_PTR','ULONG_PTR' etc..
while compiling the compiler is taking basetsd.h provided by ms-visual studio and not the one provided by win2kddk.
so i changed the path in #include for basetsd.h in ntdef.h
so that while compling ddk's verion of basetsd.h is used.
i complied and it worked 102 errors were cut down to 3 following ones:
c:\ntddk\inc\ddk\ntddk.h(9106) : error C2061: syntax error : identifier 'PCONTEXT'
c:\ntddk\inc\ddk\ntddk.h(9107) : error C2059: syntax error : '}'
c:\ntddk\inc\ddk\ntddk.h(10347) : fatal error C1189: #error : "Target architecture not defined"
now i dont know whats the problem.
the ddk is not compatilbe with vc complier or i cannot guess.
so please enlighten me with the above said problem
regards
anshu
|
|
|
|
|
I suspect you're not using the DDK command prompt that the DDK installed, which sets up the include path properly, and you're not using the BUILD tool for building drivers.
Stick to using BUILD .
A good resource for device driver development is OSR Online[^]. I suggest subscribing to their NT Insider newsletter. I seem to recall a back issue describing how to use the VC IDE with the BUILD tool.
|
|
|
|
|
I checked OSR Online, It is a very useful web site for WDM developers.
Thanks Mike,
A. Riazi
|
|
|
|
|
Hi all programmers!
Does anybody know how to set the attribute to Hidden for a file using VC++.
I have only found how to set attributes like Read-only.
Martin_j
|
|
|
|
|
Both attributes can be set with SetFileAttributes .
|
|
|
|
|
Hello all
I'm using ComboBox control and adding some strings to it. Assume that I'm adding 4 strings to ComboBox and at runtime if I select dropdown from ComboBox it's showing only two elements where to see the next two I need to scroll down.
My question is there anyway to see the entire list when dropdown is selected. If anyone knows how to do it, please help me.
Thanks for your help.
Hari.
|
|
|
|
|
Yes, you can enlarge the size at design time by clicking on the arrow and resize the rectangle to the size you want (if it's bigger than all the strings it contains, it will be clipped).
Hope this helps
|
|
|
|
|
Hello Cedric
Thanks for the reply, now I'm able to view all the list items.
Thanks for your time.
Hari.
|
|
|
|
|
You're welcome
haritadala wrote:
Thanks for your time.
Hum, I think my time is not sooo precious
|
|
|
|
|
How can I link to a .lib file in the .NET IDE?
Themis
|
|
|
|
|
In Project Properties, go to Configuration Properties > Linker > Input and add your .lib file to the Additional Dependencies field.
|
|
|
|
|
Where are the project properties? I can't find them.
Themis
|
|
|
|
|
Ah yes, the amazing disappearing menu option...
In the Solution Explorer panel, highlight your project. Go to the Project menu > Properties.
I think the idea was that the properties dialog would be context sensitive, but for someone coming from VC6, it's just annoying.
Note that the dialog isn't modal - if you click something else in Solution Explorer you'll get properties for that instead. If you click an editor window the dialog changes to a window reading 'There are no property pages for the selection'.
|
|
|
|
|
It's really amazing how magnificiently they hid it!
Thank you, Themis
|
|
|
|
|
I want to add MouseDown Event on my CButton
I try to make my class so that it inherits from CButton.
Still no luck. Please help me to solve this!!
|
|
|
|
|
Derive your own button class from CButton, e.g. CYourButton.
If you have a button in your dialog, e.g. IDC_BUTTON, do this in OnInitDialog:
m_YourButton.SubclassDlgItem(IDC_BUTTON, this);
and in the.h file: CYourButton m_YourButton;
Add the mouse button down message handler in CYourButton.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Thanks for your quick post.
I tried to add the MouseDown event(it is going to be
protected member, rigth!?) on CYourButton
and those parts you mensioned in red, but
when i tried to debug and put a break point
inside of MouseDown Event, it doesn't go to
CYourButton. I am missing something here?
Thanks for your help.
Shin
|
|
|
|
|
You are not giving me a lot of information to go on.
Anyway, if you add CYourButton in the class view and then use the Class Wizard to add a message handler for WM_LBUTTONDOWN (in CYourButton), your derived button class should look something like this:
.h:
class CYourButton : public CButton
{
public:
CYourButton();
public:
public:
public:
virtual ~CYourButton();
protected:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
};
.cpp:
CYourButton::CYourButton()
{
}
CYourButton::~CYourButton()
{
}
BEGIN_MESSAGE_MAP(CYourButton, CButton)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
void CYourButton::OnLButtonDown(UINT nFlags, CPoint point)
{
TRACE("> Left mouse button down\n\r");
CButton::OnLButtonDown(nFlags, point);
}
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Fredrik Thank you very much,
seems like i had to put presubclasswindow in my dialog class.
Now it's working.
Thanx
Shinya
|
|
|
|