the following code:

Proc1 proc

? LOCAL NumCols:UINT
invoke SQLNumResultCols, hStmt,addr NumCols
invoke MessageBox, hListViewDlg, addr NumCols, addr AppName, MB_OK

Proc1 endp


Whatever type of NumCols,such as DD,DWORD,UINT, or wherever the definition of NumCols I put, such as in .DATA?, .DATA, LOCAL,
I can't get the right number 3,(cause the table has 3 columns),but get an 'L'.
I dont understand how it works.
PS:I have used SQLDescribeCol to retrieve the information of the column and got the right return.
Posted on 2004-11-14 02:04:05 by JasonWang
MessageBox() expects a string, not a DWORD. You need to convert NumCols to a string before passing it. You can use wsprintf() for this.
Posted on 2004-11-14 05:41:50 by death
thanks, death
Actually, I just wanna put the return value, NumCols, to ecx for the loop.
But it cannot jump out of the loop, so I need to watch the value.
The only way now I know to checkout the value is using "MessageBox()".
So can you give me an simple example?
Posted on 2004-11-14 06:29:41 by JasonWang
Jason,

As it looks like you are using MASM and probably MASM32, try the text macros for string display.


fn MessageBox,hWnd,"Message Text","Title",MB_OK
; or
invoke MessageBox,hWnd,chr$("Message Text"),chr$("Title"),MB_OK

They are very convenient to use in the short term and you can have a look at the macros and procedures that make it work when you have time.

With the example you have in mind, it would be,
fn MessageBox,hWnd,str$(ecx),"Result",MB_OK
Posted on 2004-11-14 08:07:45 by hutch--
yes, hutch
I'm using masm32.
List my code:

.data?
NumCols dd ?
...

p1 proc
invoke SQLNumResultCols, hStmt, addr NumCols
...
LoopStart:
CMP ebx, NumCols
JA EndLoop
...
inc ebx
JMP LoopStart
EndLoop:
...
p1 endp

.data?
NumCols dd ?
...
--------------------------------------------------------
p1 proc
invoke SQLNumResultCols, hStmt, addr NumCols
...
LoopStart:
CMP ebx,?
JA EndLoop
...
inc ebx
JMP LoopStart
EndLoop:
...
p1 endp

The above is a simple copy of my program, the loop in first part is dead,
and the one in the following works well.
I think it something wrong with NumCols.
I haven't discovered the fault
Faint.Faint :? :? :?
Posted on 2004-11-14 08:26:28 by JasonWang