|
Hi all,
"Attempt to Update or Delete failed." and "Recordset is read-only"
These two error is occur when i update the record.
how can i resolve them.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
What "Connection String" did you use from?
(e.g.
"SELECT * FROM [MyTable]" )
|
|
|
|
|
i m not using SQL Queries.
i m using CRecordset derived class, and directly assign the value of database variable to my dialog variable.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
ThatsMe. wrote: how can i resolve them.
By opening the recordset as updateable.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi All,
I have a doubt in serial communication.
I am using non-overlapped io serial communication inside a thread in my application. So while coomunicating with the instrument, the thread gets blocked without blocking the application.
Now what is the difference between the above scenario and overlapped io communication?
Thanks for your reply .
|
|
|
|
|
In overlapped IO, the system will signal an event when the operation complete (read or write for example). But you still have to wait for that before processing your data (sure, you can't process your data if it is not available yet...). So, in general you still have to use a thread to wait on the event.
The big difference is that using this technique, you'll be able to wait for multiple events. With a blocking call, you can't do anything but wait until the function returns.
|
|
|
|
|
Hi Cedric,
Thanks for your reply.
If i place the blocking call in a thread, then the application will bot be blocked.
In this scenario what is the difference between the two types of communication?
|
|
|
|
|
No, your application won't be blocked but you can't wait for other events in the same thread.
Another point I made: by using overlapped IO, you will in general wait for the event to be signaled (so the read operation to finish for example). To do that, you will block the thread which is calling WaitForSingleObject. So, in general, even when I use overlapped IO I handle that in a separate thread. The difference, as I said before, is that you can wait for multiple events to happen instead of just one. For example you could be reading two serial ports in the same thread.
|
|
|
|
|
Communications events can occur at any time in the course of using a communications port. The two steps involved in receiving notification of communications events are as follows:
* SetCommMask sets the desired events that cause a notification.
* WaitCommEvent issues a status check. The status check can be an overlapped or nonoverlapped operation, just as the read and write operations can be.
There are two interesting side effects of SetCommMask and WaitCommEvent. First, if the communications port is open for nonoverlapped operation, WaitCommEvent will be blocked until an event occurs. If another thread calls SetCommMask to set a new event mask, that thread will be blocked on the call to SetCommMask. The reason is that the original call to WaitCommEvent in the first thread is still executing. The call to SetCommMask blocks the thread until the WaitCommEvent function returns in the first thread. This side effect is universal for ports open for nonoverlapped I/O. If a thread is blocked on any communications function and another thread calls a communications function, the second thread is blocked until the communications function returns in the first thread. The second interesting note about these functions is their use on a port open for overlapped operation. If SetCommMask sets a new event mask, any pending WaitCommEvent will complete successfully, and the event mask produced by the operation is NULL.
For more details you can refer link given below:
http://msdn.microsoft.com/en-us/library/ms810467.aspx[^]
buntyrolln
|
|
|
|
|
Continuation of above reply ....
you can use overlapped-IO operation for communication with serial com port.
Read code snippet for overlapped-IO is given below:
DWORD dwRead;
BOOL fWaitingOnRead = FALSE;
OVERLAPPED osReader = {0};
osReader.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (osReader.hEvent == NULL)
if (!fWaitingOnRead) {
if (!ReadFile(hComm, lpBuf, READ_BUF_SIZE, &dwRead, &osReader)) {
if (GetLastError() != ERROR_IO_PENDING)
else
fWaitingOnRead = TRUE;
}
else {
HandleASuccessfulRead(lpBuf, dwRead);
}
}
buntyrolln
|
|
|
|
|
Hi all,
I m working on VC++ 2005, MFC-SDI type application, I m using ODBC for connection of Access Database.
CRecordset use as Derived class of Database.
Here i want to get the index of Currently save Record.
Please tell me how can i do this.
I m waiting for your valuable suggestions.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
ThatsMe. wrote: CRecordset use as Derived class of Database.
CRecordset is derived from CObject not Database . If you have something different, perhaps that is the cause of your problem.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hi all,
In VC++ 2005, How can use keyboard on ListCtrl.
Because when i use Tab Key then the control not goes to ListCtrl.
please help me for this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Did u specify the Tab stop style( WS_TABSTOP ) to list control?
|
|
|
|
|
Yes sir.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Well even if the list control, got keyboard focus, there will not be any difference in the apperance unless one item is selected. so select one item and try pressing tab.
modified on Thursday, June 12, 2008 2:22 AM
|
|
|
|
|
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi all,
In my application after calculation i m get value in this form "2606.451613".
i want the after "." two digit value like "2606.45".
how can i do this.
Help me for this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
CString::Format helps.
CString str;
str.Format("%.02f",f);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
The other answer you got was correct, but you don't need a CString object to do this. The format specification[^] (%.02f) is the one that does the trick.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
Fixed link - June 12, 2008 3:47 AM
|
|
|
|
|
How does format specifiers for debugger solve the OP's problem?
-Saurabh
|
|
|
|
|
I got it now. I linked him to the format specifications recognized by the debugger. Link fixed, thanks for pointing out. And, my post was to emphasize that a CString object is not required to do something like that.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
No problem. You are welcome.
-Saurabh
|
|
|
|