| | |
Getting "DB_E_ERRORSINCOMMAND" even when execute is successful
![]() |
•
•
Join Date: Jul 2006
Posts: 35
Reputation:
Solved Threads: 0
When trying to set the 'max server memory' of a database I use the stored procedure (SP_COFIGURE) as follows:
However that code generates an except (access violation) on the line that has the comment (above) - not knowing why I changed the code (shown below) to the following so I could "catch" the actual error message and see what was going on...
Now this is much better but has me really confused ..??.. - the error caught (cex) is "DB_E_ERRORSINCOMMAND" - which is odd because it seems to work fine in SQL 2000 itself (Qeury analyzer) just not run via-code as such...
But that isn't the oddest part - if I continue after the exception and then check the server memory settings they have been changed successfully...
So the code WORKS but still throws an error "DB_E_ERRORSINCOMMAND" ... Why? If it works (because I can guarantee that it is correctly changing the max server memory as expected, tested this many times with different values) then why would it send back an error message?
What exactly does it mean? How can I get around this? I don't like my current fix (try/catch that just bypasses the error) - what if there is a REAL error one day? This is really an odd problem and I did some research on the net and couldn't find anything really similar - a few people mention using SET NOCOUNT ON (but I can't edit SP_CONFIGURE)...
Also - this only happens the FIRST TIME it is run, all subsequent times there is NO exception (cex) generated, no "DB_E_ERRORSINCOMMAND" ... this only happens the first time I try to make the changes...
Do I need to Initialize something first? I tried running a "RECONFIGURE" before and after - didn't make a difference...
And I haven't seen a "CONFIGURE" or "INITIALIZE" option - or whatnot like that ... I thought the problem could be that it was returning an empty row/column ... but that is just a theory...
Any help, comments, or hints would be greatly appreciated - I am really at a loss...
Thanks,
C Syntax (Toggle Plain Text)
_bstr_t bstrCommandText = OLESTR("SP_CONFIGURE 'max server memory',"); bstrCommandText = bstrCommandText + bstrServerMemory; // where bstrServerMemory = {"128" (1)} // looks like = {"SP_CONFIGURE 'max server memory',128" (1)} iCmd->CommandText = bstrCommandText; iCmd->Execute(NULL, NULL, adCmdText); // This line generate an error iCmd->CommandText = L"RECONFIGURE"; iCmd->Execute(NULL, NULL, adCmdText);
C Syntax (Toggle Plain Text)
_bstr_t bstrCommandText = OLESTR("SP_CONFIGURE 'max server memory',"); bstrCommandText = bstrCommandText + bstrServerMemory; iCmd->CommandText = bstrCommandText; try { iCmd->Execute(NULL, NULL, adCmdText); } catch (_com_error cex) { int i; // just to put something } iCmd->CommandText = L"RECONFIGURE"; iCmd->Execute(NULL, NULL, adCmdText); }
But that isn't the oddest part - if I continue after the exception and then check the server memory settings they have been changed successfully...
So the code WORKS but still throws an error "DB_E_ERRORSINCOMMAND" ... Why? If it works (because I can guarantee that it is correctly changing the max server memory as expected, tested this many times with different values) then why would it send back an error message?
What exactly does it mean? How can I get around this? I don't like my current fix (try/catch that just bypasses the error) - what if there is a REAL error one day? This is really an odd problem and I did some research on the net and couldn't find anything really similar - a few people mention using SET NOCOUNT ON (but I can't edit SP_CONFIGURE)...
Also - this only happens the FIRST TIME it is run, all subsequent times there is NO exception (cex) generated, no "DB_E_ERRORSINCOMMAND" ... this only happens the first time I try to make the changes...
Do I need to Initialize something first? I tried running a "RECONFIGURE" before and after - didn't make a difference...
And I haven't seen a "CONFIGURE" or "INITIALIZE" option - or whatnot like that ... I thought the problem could be that it was returning an empty row/column ... but that is just a theory...
Any help, comments, or hints would be greatly appreciated - I am really at a loss...
Thanks,
![]() |
Similar Threads
- Exception in thread "main" java.lang.NoClassDefFoundError: Invaders Error (Java)
- Hidden program installs .dlls with randomly generated names in random "notify" reg. (Viruses, Spyware and other Nasties)
- "No Signal" displayed on monitor (Troubleshooting Dead Machines)
- google "keyword" question (Search Engine Optimization)
- how do I run a "disconnected" stored procedure (MS SQL)
- Linux/Windows "Workgroup" Home User-Suse 9.2 (Getting Started and Choosing a Distro)
- Can't remove "about:blank" homepage. Please help. (Viruses, Spyware and other Nasties)
- I need special stuff in my project like system("cls") (C++)
- i = system ("cd c:\text"); :( (C)
Other Threads in the C Forum
- Previous Thread: problems in output ....
- Next Thread: Ellips arugument
| Thread Tools | Search this Thread |
adobe api array arrays binarysearch calculate char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators intmain() iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer posix power probleminc program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape socketprograming socketprogramming stack standard strchr string suggestions systemcall test unix urboc user variable voidmain() wab win32api windows.h





