Author Topic: Database Problem  (Read 1663 times)


  • Guest
Database Problem
« 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:
Code: [Select]
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

My code:
Code: [Select]
LoadStructureArray PROC


;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
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
assume esi:nothing
pop esi
invoke SQLFreeHandle, SQL_HANDLE_STMT, hStmt
LoadStructureArray EndP


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!
« Last Edit: May 30, 2012, 03:47:30 PM by hutch-- »