The MASM Forum
General => The Campus => Topic started by: peaslee on May 29, 2012, 10:24:47 AM
-
The following runs with no errors, but the data is not going into the temporary structure. If I dummy up data (the commented-out lines) it works, so I have to assume it's somewhere in the SQL. I'm working off of Iczelion's tutorial, but he doesn't have an example for integers.
The structure:
LOT STRUCT
lotNumber DWORD ? ;builder-assigned. if zero, end of data
address db 255 dup(?) ;lot address, not mailing address
homePhone db 255 dup(?)
vacant DWORD ? ;is home vacant
forSale DWORD ?
rented DWORD ?
basePrice DWORD ? ;initial price before upgrades
upgrades DWORD ? ;price of upgrades
asking DWORD ? ;asking price, if for sale
x DWORD ? ;x-coordinate of lot
y DWORD ? ;y-coordinate of lot
w DWORD ? ;width (of control) for lot
h DWORD ? ;height(of control) for lot
hwnd DWORD ? ;control handle
LOT EndS
My code:
LoadStructureArray PROC
LOCAL tempLot:LOT
LOCAL stringLen:DWORD
;mov tempLot.lotNumber, 0 ;these commented-out lines show that the m2m instructions work
;mov tempLot.x, 120
;mov tempLot.y, 20
;mov tempLot.w, 100
;mov tempLot.h, 200
invoke SQLExecDirect, hStmt, ADDR SqlSelectStatement, SIZEOF SqlSelectStatement
invoke SQLBindCol , hStmt, 1 ,SQL_C_SLONG , tempLot.lotNumber, SIZEOF tempLot.lotNumber, ADDR stringLen
invoke SQLBindCol , hStmt, 10,SQL_C_SLONG , tempLot.x, SIZEOF tempLot.x, ADDR stringLen
invoke SQLBindCol , hStmt, 11,SQL_C_SLONG , tempLot.y, SIZEOF tempLot.y, ADDR stringLen
invoke SQLBindCol , hStmt, 12,SQL_C_SLONG , tempLot.w, SIZEOF tempLot.w, ADDR stringLen
invoke SQLBindCol , hStmt, 13,SQL_C_SLONG , tempLot.h, SIZEOF tempLot.h, ADDR stringLen
push esi
mov esi, offset lot
assume esi:ptr LOT
mov ebx, 0
.while ebx < 3 ;just test for the first few records
invoke SQLFetch, hStmt
.if ax != SQL_SUCCESS
invoke MessageBox, NULL, chr$("Fetch Failure"), chr$("Test"), MB_OK
ret
.endif
m2m [esi].x, tempLot.x
m2m [esi].y, tempLot.y
m2m [esi].w, tempLot.w
m2m [esi].h, tempLot.h
add esi, type LOT
inc ebx
.endw
assume esi:nothing
pop esi
invoke SQLFreeHandle, SQL_HANDLE_STMT, hStmt
Ret
LoadStructureArray EndP
Thanks
EDIT: Never mind. It works. This code is meant to retrieve the location of controls, which it does. The problem was that the first three controls are created at x=2125,2225, and 2325. This is off the screen. Ouch!