parameter or argument passing in DBselect


HI

i have Database MS-SQL and also screen is designed in indusoft. the screen script is written to read a table from the database and only read the last/latest row inserted in which there are 2 columns to be read. following some examples i written the as below:-


'Variables available on this screen can be declared and initialized here.
Dim sql, numCur, numRows, Row,txt

'This procedure is executed continuously while this screen is open.
Sub Screen_WhileOpen()

sql ="SELECT * FROM aztitechCrowdCam207"
numCur=$DBCursorOpenSQL("CrowdCamDB",sql)
numRows=$DBCursorRowCount(numCur)
$DBCursorClose(numCur)

$Trace("the value of totalRow is " &numRows)


$DBSelect("CrowdCamDB","aztitechCrowdCam207","$Coach_ID_1_CAM_1","CamID","ID=1","")
$DBSelect("CrowdCamDB","aztitechCrowdCam207","$Coach_ID_1_CAM_1_STA","CamStatus","ID=1","")
$DBSelect("CrowdCamDB","aztitechCrowdCam207","$Coach_ID_1_IN","CamEntryNbr","ID=5","")
$DBSelect("CrowdCamDB","aztitechCrowdCam207","$Coach_ID_1_OUT","CamExitNbr","ID=5","")


in the above script,i can read the number of rows in the table, then the idea is to pass the number of rows value as an argument/parameter into the DBselect command, for now as u can see i just manually set is as "CamEntryNbr","ID=5","") and this is fixed, the ID field refers to the row number, so how do i pass the numRows as the argument, so that on each loop if the numRows count if is being updated, i can update the screen with the last inserted row's infomation. My main concern is i just need to read the info on the last inserted rows.

i have try as below but i got syntax errror:-

$DBSelect("CrowdCamDB","aztitechCrowdCam207","$Coach_ID_1_IN","CamEntryNbr","ID=&numRows","")

SO how can pass argument into DBselect command??


Parents Reply Children
No Data