Click here to Skip to main content
15,915,674 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Memory aligned bit fields Pin
Alain Rist25-Sep-10 9:57
Alain Rist25-Sep-10 9:57 
GeneralRe: Memory aligned bit fields Pin
Aescleal25-Sep-10 10:19
Aescleal25-Sep-10 10:19 
AnswerRe: Memory aligned bit fields Pin
Alain Rist25-Sep-10 11:26
Alain Rist25-Sep-10 11:26 
GeneralRe: Memory aligned bit fields Pin
Aescleal25-Sep-10 22:31
Aescleal25-Sep-10 22:31 
GeneralRe: Memory aligned bit fields Pin
Trevor Johansen25-Sep-10 10:51
Trevor Johansen25-Sep-10 10:51 
GeneralRe: Memory aligned bit fields Pin
Aescleal25-Sep-10 22:34
Aescleal25-Sep-10 22:34 
QuestionDirectX - Antialiasing and Plotting Pixels Query [Moved] Pin
simon alec smith24-Sep-10 9:52
simon alec smith24-Sep-10 9:52 
QuestionHow to process multiple commands on CAccessor. Pin
Spawn@Melmac24-Sep-10 8:36
Spawn@Melmac24-Sep-10 8:36 
Yes I know it is a Database question but I have not had much luck in that forum so I am looking for a fresh perspective.

I am using accessors to perform DB queries which works fine except when I come to do INSERTs.

This is the SQL in the accessor
DEFINE_COMMAND_EX(CDBEvtRawInsert, L" \
   INSERT INTO [RawEvent] ([TimeStamp],[Direction],[Hub],[RawEvent])	\
   VALUES (GETDATE(),? ,? , ?);")


which works fine with this snippet...
wcscpy_s(rsEvtRawInsert.f_RawEvent, iSize*2, CA2T(pTmp));	// put it in the accessor
rsEvtRawInsert.f_Direction = 1;					// indicate this is received data
rsEvtRawInsert.f_HubID = m_pHubDev->m_iHubID;			// and from this hub
hr = rsEvtRawInsert.Open(m_oDB->session);			// store it


However in order to retrieve the ID of the record which has just been inserted I need to add SELECT @@IDENTITY AS RecID to the SQL but this makes it a multiple command accessor which is where my problem is.


I have search MSDN and the SDK's but for the life of me I cannot find anything that shows me how to code the accessor properly to deal with the multiple results. I know I can use GetNextResult to move onto the second result set but I cannot get it to work.

It has been suggested using ExecuteScalar would be the solution but as I am going to have multiple threads executing the same code I would prefer to use the @@IDENTITY to avoid any possible collisions between the threads.

The only other solutions I can think of are to either issue a search to find the record I have just created OR maintain a counter which would track the ID field.

Does anyone have any other ideas or point me to a way to get the accessor to process my multiple commands?
Alan

QuestionGetHeaderCtrl returns null Pin
genush24-Sep-10 6:09
genush24-Sep-10 6:09 
AnswerRe: GetHeaderCtrl returns null Pin
genush24-Sep-10 7:39
genush24-Sep-10 7:39 
QuestionPop sound at the end of playing .wav audio Pin
Danzy8324-Sep-10 2:34
Danzy8324-Sep-10 2:34 
AnswerRe: Pop sound at the end of playing .wav audio Pin
Code-o-mat24-Sep-10 3:03
Code-o-mat24-Sep-10 3:03 
GeneralRe: Pop sound at the end of playing .wav audio Pin
Danzy8324-Sep-10 3:11
Danzy8324-Sep-10 3:11 
GeneralRe: Pop sound at the end of playing .wav audio [modified] Pin
Code-o-mat24-Sep-10 4:43
Code-o-mat24-Sep-10 4:43 
QuestionDelete a View Pin
john563224-Sep-10 1:24
john563224-Sep-10 1:24 
AnswerRe: Delete a View Pin
Eugen Podsypalnikov24-Sep-10 2:29
Eugen Podsypalnikov24-Sep-10 2:29 
GeneralRe: Delete a View Pin
john563224-Sep-10 4:48
john563224-Sep-10 4:48 
AnswerRe: Delete a View [modified] Pin
mesajflaviu24-Sep-10 6:28
mesajflaviu24-Sep-10 6:28 
QuestionMaking an app single instance Pin
sashoalm24-Sep-10 0:20
sashoalm24-Sep-10 0:20 
AnswerRe: Making an app single instance Pin
«_Superman_»24-Sep-10 0:50
professional«_Superman_»24-Sep-10 0:50 
AnswerRe: Making an app single instance Pin
Kushagra Tiwari24-Sep-10 2:56
Kushagra Tiwari24-Sep-10 2:56 
GeneralRe: Making an app single instance Pin
Sauro Viti24-Sep-10 3:57
professionalSauro Viti24-Sep-10 3:57 
AnswerRe: Making an app single instance Pin
Cool_Dev24-Sep-10 3:04
Cool_Dev24-Sep-10 3:04 
QuestionRe: Making an app single instance Pin
sashoalm24-Sep-10 3:07
sashoalm24-Sep-10 3:07 
AnswerRe: Making an app single instance Pin
Cool_Dev25-Sep-10 20:49
Cool_Dev25-Sep-10 20:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.