I’m getting the below access violation error. Is this related to any database connectivity or permission issue? I tried looking into the CLW file for the particular line below is the code which is pointing to.
The exception occurs on attempt to read by address 72725420h. EBX and ESI registers have this value. It looks like the part of string ’ Err’. So, it’s definitely the problem in the program. Most probably, it is inside the call to qsql.sendquery.
Thanks for the reply. I’m trying to fetch the records from SQLserver to the list control. Is the below code from CLW file is correct to fetch the records from SQL server. Or any code need to change for this. Below the snapchat of CLW file.
Whether ‘gSQL.SendQuery’ & ‘gSQL.FillQueueWithResult’ are the correct field name to fetch the records from sqlserver. If not can anyone please suggest the correct syntax for this.
The problem is not in the SQL query’s text. Some code, probably in qsql.sendquery or called from that function, uses a part of string instead of address. This can be result of incorrect prototyping of some function or declaration of some data structure, incorrect work with QUEUEs having fields of ANY type, etc. Impossible to say exactly having no your sources. Try to use the debugger.
I can suggest several ways you can narrow this error down.
Go to your Application | Open Application Project. On the Compiling tab set “Add line number information to map file” to true. Rebuild your app. You will then get line numbers beside the crash panel.
I use dbgview.exe, free from Microsoft, extensively throughout my apps to load debug statements to a viewer. I can globally turn it off/on so it’s permanent in my code but you can simply add:
Global:
MODULE('Windows.DLL')
OMIT('***',_WIDTH32_)
OutputDebugString(*CString),PASCAL,RAW
***
COMPILE('***',_WIDTH32_)
OutputDebugString(*CString),PASCAL,RAW,NAME('OutputDebugStringA')
***
END
Locally: OutputDebugString('anything you can imagine here')
Instead, I have a common procedure, as opposed to a class, that gives me logging
Debug PROCEDURE (String DebugString)
DB CSTRING(500)
CODE
if GLO:ExternalDebug !if logging
Relate:zDebugLog.Open
SET(zDL:bySysID)
IF Access:zDebugLog.Previous() <> Level:Benign
zDL:SysID = 1
ELSE
zDL:SysID += 1
END
zDL:SiteID = GLO:SiteID
zDL:Memo = DebugString
Access:zDebugLog.Insert()
else
DB = CLIP(DebugString) & '<13,10,0>'
OutPutDebugString(DB)
end
Relate:zDebugLog.Close
RETURN
Another option is Capesoft’s Breakin product. It allows you to stop the program and see where you are and how you got there. I find it especially useful when a crash is in Clarion code and I need to see what I did to cause it.
You can dynamically size in the CSTRING() declaration. Below code makes DB big enough to fit the passed DebugString size + 4 bytes … The 4 = 2 for the 13,10 + 1 for the <0> + 1 extra incase zero bytes passed.
This way if you pass a 4000 byte string it is not truncated to 500 bytes, and you do not need to declare DB overly large to fit most anything like 10,000 bytes.
You’ll sometimes see this done with a reference DB &CSRING and new DB &= NEW(CSTRING( SIZE()+4)) but then you have to DISPOSE(DB).
The way I code my little Debug Trace procedure is below. I allow a Prefix text that always gets included.
MAP
DB(STRING DebugMessage) !OutputDebugString
MODULE('WinAPI')
OutputDebugString(*cstring Msg),PASCAL,RAW,DLL(1),NAME('OutputDebugStringA')
END
END
!----------------------------------------
DB PROCEDURE(STRING xMessage)
Prfx EQUATE('PrefixText: ') !All output gets this Prefix
sz CSTRING(SIZE(Prfx)+SIZE(xMessage)+3),AUTO
CODE
sz = Prfx & CLIP(xMessage) & '<13,10>'
OutputDebugString( sz )
!--------------------- without Prefix text --------------------
DB PROCEDURE(STRING xMessage)
sz CSTRING(SIZE(xMessage)+3),AUTO
CODE
sz = CLIP(xMessage) & '<13,10>'
OutputDebugString( sz )