|
I'm creating a program that stores packets into an oracle DB. When I try to get a count of how many entries are in my 'packet' table I receive an "ORA-00911: invalid character" exception.
Oracle describes this error:
ORA-00911: invalid character
Cause:
identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual.
And my code that causes the error....
{
String *cmdString = S"SELECT COUNT(*) AS rowcount FROM packet;";
OleDb::OleDbCommand *oracleCommand1 = new OleDb::OleDbCommand();
oracleCommand1->Connection = oracleConnection;
oracleCommand1->CommandText = cmdString;
oracleConnection->Open();
gPacketCount = Convert::ToInt64(oracleCommand1->ExecuteScalar());
}
Is the asterisk in 'COUNT(*)' causing my error? If so, is there another way to get a row count?
|
|
|
|
|
cpp_and_asm wrote: Is the asterisk in 'COUNT(*)' causing my error?
Not sure what is causing your error, but I doubt the asterisk isn't the problem...
|
|
|
|
|
It's not the semicolon is it?
|
|
|
|
|
nope, Ive tried it without the semicolon already.
|
|
|
|
|
I rebooted my comp this morning and ran it without the semicolon again and it worked
Thanks for the replys!
|
|
|
|
|
hi there,
Anyone know how to make a splitter of a custom control with 2 view to scroll together vertically? the custom control is CWnd base class.
Thanks for any help or replies
|
|
|
|
|
hi there.
Is it possible to scroll static text(in text properties, Client edge checked in the Extended Styles tab). However, it should not have a scroll bar. The text in the static text(with client edge style) will move up or down according to the scroll bar from a custom control with the based class of CWnd.
If not, are there any suggestion on how todo this?
|
|
|
|
|
did u try calling ScrollWindow() or sending the WS_VSCROLL / WS_HSCROLL messages to the window
nave
|
|
|
|
|
I found some runtime error in my solution
with the IDE: Visual Studio .Net 2003.
1st problem:
I inherited the STL class complex<_Ty>, and
add some members to the class. However,I found
the operator overloading didn't work well. I
follow the way <complex> did in the overloading
function:
return complex(x,y);
but the left side of the = lost many members.
and the builder would inevitably warn:
warning C4172: returning address of local variable or temporary<br />
'Complex.h(382) : while compiling class-template member function 'Complex<_Ty>::_Myt &Complex<_Ty>::operator *(const Complex<_Ty>::_Myt &)'<br />
with<br />
[<br />
_Ty=double<br />
]
Is there any suggestion? thanks!
2nd problem:
While debugging the code, I found SOME of the member
functions cannot be broke! but others CAN! and some
breakpoints would jump to the other functions while
debugging.
These break points would be marked with INFAMOUS white
question marks which said:
The breakpoint would not currently be hit. Invalid file line:353
I'd checked the configuration, it's set on debug mode.
Searching on the web but found no proper way.
Is there any suggestion? Thanks!
|
|
|
|
|
ytod wrote: warning C4172: returning address of local variable or temporary
you might have declared the operator overloaded funtion to return either the address od reference. Remove the reference or pointer in the return type of the function. If you paste the function here I will try to make it correct.
ytod wrote: While debugging the code, I found SOME of the member
functions cannot be broke! but others CAN!
the breakpoint cannot be put in some place where..
1. you have put a preprocessor switch so that, that part of code dosent get compiled and exists in the exe build
2. In an inline function
3. If control never reaches that point.
nave
|
|
|
|
|
|
I have some code that does (essentially) this:
...
char string[ 1024 ];
unsigned long length = 0;
strcpy( &string[ length ], ~arbitrary string 0~ );
length += strlen( &string[ length ] );
strcpy( &string[ length ], ~arbitrary string 1~ );
length += strlen( &string[ length ] );
...
strcpy( &string[ length ], ~arbitrary string n~ );
length += strlen( &string[ length ] );
...
This causes a 64-bit issue due to strlen returning size_t--64-bits on a 64-bit machine. There are two solutions:
solution 1 --
...
size_t length = 0;
...
solution 2 --
...
strcpy( &string[ length ], ~arbitrary string 0~ );
length += ( unsigned long )strlen( &string[ length ] );
...
In solution 1, 'length' becomes 64-bits and (presumably) more bits are being calculated.
In solution 2, 'length' remains 32-bits and (presumably) fewer bits are being calculated.
Assuming that this activity is happening at a high enough rate to matter, which approach would have better performance? Or does it not matter.
At present I do not have a 64-bit machine to test on.
-Obi Wan 2
|
|
|
|
|
I'd say best performance is with solution 1 in both 32 and 64 bit builds.
More bits aren't being calculated. size_t is 32 bits on 32-bit build and 64 bits on 64-bit
build. A 64=bit processor I presume will handle 64-bit integers just like a 32-bit processor
handles 32-bit integers. (*EDIT* ok technically more bits are being "calculated" but using
the same amount of machine instructions.)
In solution 2, on a 64-bit build, "length" stays 32-bit but all its uses are expecting 64-bit
so every time it's used there's a type conversion.
|
|
|
|
|
Mark:
Thanks.
It's true that in solution each use would cause a type conversion, but a trivial one. The processor could have a 32-bit load that forces the high order 32-bits to zero with no processing cost.
The more I think on it, the more I think there is no difference, but that solution 1 is more aesthetic.
-Obi Wan 2
|
|
|
|
|
Obi Wan 2 wrote: The more I think on it, the more I think there is no difference, but that solution 1 is more aesthetic.
I agree.
|
|
|
|
|
I have a Win32 console-based program which does this:
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
...
if( something failed )
{
nRetCode = 1;
}
return nRetCode;
} My customer is telling me that they are always getting errorlevel 0, and never getting errorlevel 1 upon failure.
I'm wondering, is return the proper way to return an errorlevel??? Or should I be using some other method? I seem to recall some sort of exit() function a million years ago from the old DOS days.
Thanks for any assistance!
|
|
|
|
|
chimera967 wrote: always getting errorlevel 0, and never getting errorlevel 1 upon failure
Are they sure the failure condition is ever being executed?
|
|
|
|
|
Maybe it's never failing!
AFAIK, you'll need to use exit() to work with ERRORLEVEL.
void _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nExitCode = EXIT_SUCCESS;
...
if( something failed )
{
nExitCode = EXIT_FAILURE;
}
exit(nExitCode);
}
|
|
|
|
|
That looks ok, the return value of main() is used as the process's exit code.
|
|
|
|
|
Well, im making a game, its great... except for this error, with this line:
Angle = asin((From->DestX - (Current->xPos /*Add offset*/))/SwingDistance);
In short that is:
Angle = asin((50 - 100)/65);
The numbers are just examples but you get the idea. Anyway, sometimes, it works perfectly, and its absolutley fine. Others, the angle gets set to -1#IND0 and my x,y co-ords get set to 0,0 as a result.
I debug it, check the values, put it into a calculator, and it works just fine.
So are there any ideas on this, has it come up before?
|
|
|
|
|
Wait, no, my foolish error with the calculator, it doesn't work.
Im just gonna put this down to inaccuracies when calculating the next position. I've sinced changed the method slightly, and all is good now.
|
|
|
|
|
I have to support French for an application.
All the resources of my application are stored in a DLL for French. when select default language, main resource is loaded and if select french, french dll of resource is loaded. Everything is fine as long as no custom controls are used.
I get a problem with custom control when load resource dll:
In old version, there is a control which managed by ActiveX Control, when i load resource dll (french) -> DONE:
CONTROL "",IDC_PREF_DIALOG_HIST,
"{E41EAFC4-F536-11CF-93A1-0000C0A61E5A}",WS_TABSTOP,7,7,
397,114
But in new version, this control is edit to Custom Control and manage by a new class (CHistogramCtl). when I use default language (English) => OK. But when I use french language (resource DLL), I could not load dialog which contain this control.
CONTROL "Custom2",IDC_PREF_DIALOG_HIST,"Histogram_Ctrl_Class",
WS_TABSTOP,7,7,397,118,WS_EX_CLIENTEDGE
Any suggestion will be helpful.
Thanks in advance,
Papais
Papais
|
|
|
|
|
How u create resources in French Language in VC++.
Thanks
Atool
Atool
|
|
|
|
|
I am using Visual C++ 6.0 MFC. I have gotten my secondary thread to work using AfxBeginThread(TestThread, this); but I don't want to use TerminateThread() based upon what I have been reading. When the secondary thread is spawned it may take 20 minutes for it to complete. I have a button on the tab page that spawned the thread that I want to use to 'Cancel Test' but I am confused as how to go about telling the thread to terminate itself cleanly. The psuedo code is as follows -
UINT C65602::TestThread(LPVOID Param)
{
C65602* device_type = (C65602*)Param;
device_type->TestThread();
return 0;
}
void C65602::TestThread()
{
HRESULT hr = CoInitialize(NULL);
pTests->pOutput->OpenExcelWorksheet();
pTests->RunTest(); // This may take 20 minutes
CoUninitialize();
AfxEndThread(0, TRUE);
}
void C65602::OnButtonBeginTest()
{
AfxBeginThread(TestThread, this);
}
void C65602::OnButtonCancelTest()
{
// I beleive this is where I want to tell the thread to terminate itself.
pTests->pGPIB->TurnOffDevice();
pTests->pOutput->SaveAndQuitExcel();
// or does it need to be here because of the Excel Automation im using?
AfxMessageBox("Test Canceled", MB_ICONINFORMATION);
CTabPage::OnCancel();
}
If anyone can push me in the right direction, throw me off the cliff.
Buck
|
|
|
|
|
You may find this[^] article (specifically the section "Pausing a Thread and Thread Shutdown") helpful.
/ravi
|
|
|
|