|
prithaa wrote: The same query works with Access
How is that possible? In the code you posted there's no way the CDatabase object can know which
database to perform the query on.
If you Google the error "The operation must use an updateable query" you'll find that the most
common reason is database opened read only. You haven't shown how you open the database.
Mark
|
|
|
|
|
|
Hello,
CDatabase C;CString D="Students";
C.Open(_T(D),FALSE,TRUE,_T("ODBC"));
CRecordset R;
R.Open(dbOpenDynaset,_T("SELECT * FROM Table1"));
CString str = "UPDATE Table1 SET ROLLNO = 45";
C.ExecuteSQL(str);
R.Close();
The above is the full code.
Thanks for your reply
Prithaa
|
|
|
|
|
Hello,
Sorry to have bothered
I got my mistake.My Database was opened readonly so the query was not able to update the records
Thanks
PRithaa
|
|
|
|
|
I glad you find it
|
|
|
|
|
prithaa wrote:
The above is the full code.
So why didn't you show this in your initial post? It's plain to see that the CDatabase object was opened as read-only.
prithaa wrote: C.ExecuteSQL(str);
Should have been:
if (R.CanUpdate())
C.ExecuteSQL(str);
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi,
I just ended a debate with someone and this was the topic:
When an application (hw.cpp) is compiled with a library (library.lib) does the resulting executable contain the entire library.lib or does it just contain the functionality (the code) it needed from the library and, of course, hw.cpp.
Personally, I'm positive it only contains the code it needed from the lib - not the entire lib.
Thanks.
|
|
|
|
|
you're right. the linker will pull in only what the app needs.
that is, without getting into a discussion of 'compilation units' and other arcana, the linker, on the whole, doesn't pull in things you don't use.
-- modified at 11:58 Wednesday 6th December, 2006
|
|
|
|
|
Thanks Chris, you've helped me out before, too.
Thanks again!!
C
|
|
|
|
|
I need to use function byte*strcat(byte*, const byte*)in following
strcat(byte* dest, ":");
I receive following warning:
warning C4133: 'function' : incompatible types - from 'char [2]' to 'const byte *'
How to resolve this problem?
|
|
|
|
|
how's defined your type byte ?
have you tried to explicitely cast to (char*) and (const char*) respectedly ?
moreover, what doest that mean : strcat(byte* dest, ":");
is it how you call your function ???
oh, and at last, it is a warning, not an error, so, nothing blocking !
|
|
|
|
|
lose the 'byte *'.
Calls should not contain thier datatype unless you are specifically casting it to that type and then you need to wrap the data type in parenthesis or angle brackets.
such that,
strcat(byte* dest, ":");
becomes,
strcat((byte*) dest, ":"); /*byte* is 'casted'*/
Otherwise, just plan ol' remove the byte* from your statement, resulting in:
strcat(dest, ":");
Ideally, you should ensure your datatypes are the same whereever possible.
|
|
|
|
|
I want to link txt files(help file) into EXE files.
Please give me some idea for this issue.
|
|
|
|
|
Add them as RT_RCDATA resource types.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Max++ wrote: want to link txt files(help file)
Out of curiosity, why not use HTMLHelp? It actually makes it easier to maintain.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
I've used MFC to create a custom control: An Ellipse with an edit control inside, so it appears as a circular edit box. Problem is, I can't get the data out from the edit control whenever I type anything in. I'm using the windows message handler WM_CHAR, but I fear that that message handler is only interested in the rectangle and not the edit control. How do I get access to the edit control's data?
Thanks
|
|
|
|
|
MyFathersSon wrote: Problem is, I can't get the data out from the edit control whenever I type anything in
Maybe these will help?
Three ways to get text from an edit control:
CEdit::GetWindowText()
EM_GETLINE message to edit control
WM_GETTEXT message to edit control
|
|
|
|
|
Cheers Mark, Unfortunately I feel that the code might be causing problems. I code the control as follows:
void CEditableCircleCtrl::DrawControl()//called by OnDraw method
{
CDC *pDC = GetDC();
if(pDC == NULL)
{
return;
}
CRect circlerect;
//draw the round rectangle
circlerect.top = 0;
circlerect.left = 0;
circlerect.bottom = 40;
circlerect.right = 40;
pDC->Ellipse(circlerect);
}
...
int CEditableCircleCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
//create the edit box
editrect.top = 13;
editrect.left = 6;
editrect.bottom = 28;
editrect.right = 36;
editctrl.Create(WS_VISIBLE|WS_CHILD|ES_CENTER,editrect, this, 0);
return 0;
}
How can I get hold of the text? Am I doing something wrong? WM_CHAR doesn't capture any text entered in the control. Where would I place any of your suggestions?
|
|
|
|
|
WM_CHAR would be sent to your editctrl object (which I assume is a CEdit(?)) so you'd need to
override CEdit and in your derived class handle WM_CHAR. That's if you really need to intercept
every char as it is entered by the user.
Anytime you want to extract the text from the edit control (after it is created, of course) you
can use something like
TCHAR szBuffer = new TCHAR[editctrl.GetWindowTextLength() + 1];
editctrl.GetWindowText(szBuffer, GetWindowTextLength() + 1); or
CString str;
editctrl.GetWindowText(str);
|
|
|
|
|
Cheers Mark, that was very helpful. Thanks for your time
|
|
|
|
|
Hie,
I have one function
void Log(const string& format="", ...)
{
va_list args;
va_start(args,format);
int len= vsprintf(buffer, format, args);
va_end(args);
cout<
|
|
|
|
|
vikrams wrote: vsprintf(buffer, format, args);
Maybe you are passing a invalid format string. If it's not a valid format string then the behavior is undefined.
Maybe you can modify the above function to look like this...
void __cdecl Log( const char* lpszString, ... )
{
va_list args;
va_start(args, lpszString );
int len = vsprintf(buffer, lpszString, args );
va_end(args);
}
And what is this buffer variable??
|
|
|
|
|
I tried using format.c_str().
but it's crashing.
|
|
|
|
|
please Vikrams you start to know CP well enough nowadays to know that you should post code samples within <pre></pre> html tags...
see my sig for a relevant link
|
|
|
|