Steve Hume
2004-05-14 11:51:04 UTC
Hi
I’m developing a SDI project that allows a user to edit text in a MSSQL7 database table. This is achieved via ODBC through an edit box control. I'm using Visual C++ 6 on Windows 2000 Server, but will shortly be carrying on the project on NT4 workstatio
The data type on the db field is varchar (2000) and the VC++ member variable type for the edit control is CString value with validation - again 2000 characters
However I've found that whenever over 256 characters are entered an error is returned i.e:
'Please enter no more than 256 characters.
Using the debugger I've traced the error back to a validation routine that starts on line 254 of DBVIEW.CPP. The function in question is void AFXAPI DDX_FieldText where a call to CString::GetAllocLength is tested against the actual length of the string in the edit control. There is a rather cryptic comment above this bit of code which reads:
'// check if length is too long (this is complicated by Windows NT/J)
Has anyone got any ideas on this or how to get round the problem? I find it rather difficult to believe that it has not been encountered before and yet I can find no reference to it on the MSDN Knowledge Base. The closest was a reference to a bug on Visual C++ 4 where ''Please enter no more than 0 characters' was returned when using the same function in a DAO context (Daview.cpp)
Many Thank
Steve Hum
I’m developing a SDI project that allows a user to edit text in a MSSQL7 database table. This is achieved via ODBC through an edit box control. I'm using Visual C++ 6 on Windows 2000 Server, but will shortly be carrying on the project on NT4 workstatio
The data type on the db field is varchar (2000) and the VC++ member variable type for the edit control is CString value with validation - again 2000 characters
However I've found that whenever over 256 characters are entered an error is returned i.e:
'Please enter no more than 256 characters.
Using the debugger I've traced the error back to a validation routine that starts on line 254 of DBVIEW.CPP. The function in question is void AFXAPI DDX_FieldText where a call to CString::GetAllocLength is tested against the actual length of the string in the edit control. There is a rather cryptic comment above this bit of code which reads:
'// check if length is too long (this is complicated by Windows NT/J)
Has anyone got any ideas on this or how to get round the problem? I find it rather difficult to believe that it has not been encountered before and yet I can find no reference to it on the MSDN Knowledge Base. The closest was a reference to a bug on Visual C++ 4 where ''Please enter no more than 0 characters' was returned when using the same function in a DAO context (Daview.cpp)
Many Thank
Steve Hum