Click here to Skip to main content
15,894,740 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: class array, better understanding of it Pin
Richard MacCutchan2-Jan-12 22:02
mveRichard MacCutchan2-Jan-12 22:02 
GeneralRe: class array, better understanding of it Pin
jkirkerx3-Jan-12 7:22
professionaljkirkerx3-Jan-12 7:22 
GeneralRe: class array, better understanding of it Pin
Richard MacCutchan3-Jan-12 22:28
mveRichard MacCutchan3-Jan-12 22:28 
GeneralRe: class array, better understanding of it Pin
jkirkerx4-Jan-12 6:54
professionaljkirkerx4-Jan-12 6:54 
AnswerRe: class array, better understanding of it Pin
Stefan_Lang3-Jan-12 5:26
Stefan_Lang3-Jan-12 5:26 
GeneralRe: class array, better understanding of it Pin
jkirkerx3-Jan-12 7:24
professionaljkirkerx3-Jan-12 7:24 
GeneralRe: class array, better understanding of it Pin
Stefan_Lang3-Jan-12 22:41
Stefan_Lang3-Jan-12 22:41 
GeneralRe: class array, better understanding of it Pin
jkirkerx4-Jan-12 7:08
professionaljkirkerx4-Jan-12 7:08 
I can comment on it now, it was a fine post.

I implemented your revised edition, and liked it better, because I wasn't using the new statement for each record.

It worked great, thank you very much.

I ended up deleting the whole thing, and took the gui (hwnd)to the ODBC function. The ODBC function created pointers to buffers, that were held by the SQLHandle. The first array record was fine, but records after that were corrupted.

So I have to rethink how this would work in ODBC, Which is another subject. I'm thinking that I need to implement your version of the array inside the ODBC Function itself.

The code below was a bad idea. I tried using the array directly in the GetData, but I wasn't able to use the size in the array elements. Anyways, that's a different subject.

if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS) {			
												
INT			i = 0;
INT			pzUserID; <- This should of been an array element
WCHAR			pzFirstName[cbFirstName]; <- This should of been an array element
WCHAR			pzLastName[cbLastName]; <- This should of been an array element
WCHAR			pzUserName[cbUserName]; <- This should of been an array element
						
while (SQLFetch(hstmt) == SQL_SUCCESS) {
	// Get Data from the Table
	SQLGetData(hstmt, 1, SQL_C_ULONG, &pzUserID, 0, NULL );
	SQLGetData(hstmt, 2, SQL_C_WCHAR, &pzFirstName, cbFirstName, NULL );
	SQLGetData(hstmt, 3, SQL_C_WCHAR, &pzLastName, cbLastName, NULL );
	SQLGetData(hstmt, 4, SQL_C_WCHAR, &pzUserName, cbUserName, NULL );

        // Original -I used the pointers above to populate the array at this point, but I should of just went direct into the array, instead of using the temporary pointers in between. But in theory once I free the SQL handle, the pointers are gone. So Perhaps in the future, I need to create multi part functions, one that Initializes, one that gets the data and packages it, and one that closes the handle, passing the handle to each function until complete.

}

QuestionCreateThread Pin
columbos149272-Jan-12 5:14
columbos149272-Jan-12 5:14 
AnswerRe: CreateThread Pin
Richard MacCutchan2-Jan-12 6:18
mveRichard MacCutchan2-Jan-12 6:18 
AnswerRe: CreateThread Pin
Chris Losinger2-Jan-12 6:56
professionalChris Losinger2-Jan-12 6:56 
GeneralRe: CreateThread Pin
Richard MacCutchan2-Jan-12 7:31
mveRichard MacCutchan2-Jan-12 7:31 
GeneralRe: CreateThread Pin
Chris Losinger2-Jan-12 7:34
professionalChris Losinger2-Jan-12 7:34 
GeneralRe: CreateThread Pin
Richard MacCutchan2-Jan-12 21:52
mveRichard MacCutchan2-Jan-12 21:52 
AnswerRe: CreateThread Pin
Rajesh R Subramanian2-Jan-12 7:42
professionalRajesh R Subramanian2-Jan-12 7:42 
AnswerRe: CreateThread Pin
CPallini2-Jan-12 8:16
mveCPallini2-Jan-12 8:16 
QuestionWant to Do This for a Living Pin
DragonHeart3351-Jan-12 10:31
DragonHeart3351-Jan-12 10:31 
AnswerRe: Want to Do This for a Living Pin
CPallini1-Jan-12 10:42
mveCPallini1-Jan-12 10:42 
GeneralRe: Want to Do This for a Living Pin
DragonHeart3351-Jan-12 11:09
DragonHeart3351-Jan-12 11:09 
GeneralRe: Want to Do This for a Living Pin
CPallini1-Jan-12 11:20
mveCPallini1-Jan-12 11:20 
QuestionRe: Want to Do This for a Living Pin
Randor 1-Jan-12 20:51
professional Randor 1-Jan-12 20:51 
AnswerRe: Want to Do This for a Living Pin
CPallini1-Jan-12 21:28
mveCPallini1-Jan-12 21:28 
GeneralRe: Want to Do This for a Living Pin
Randor 1-Jan-12 21:33
professional Randor 1-Jan-12 21:33 
GeneralRe: Want to Do This for a Living Pin
CPallini1-Jan-12 21:37
mveCPallini1-Jan-12 21:37 
AnswerRe: Want to Do This for a Living Pin
DragonHeart3352-Jan-12 1:11
DragonHeart3352-Jan-12 1:11 

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.