Home > Language Reference > Database Functions > DbClose

DbClose

The DbClose function closes the recordset created by the DbSelect function.

Syntax

ret=DbClose()

Parameters

None.

Return value

ret, optional numeric return value. If the function successfully closes the recordset, the return value is 0. If the function fails, the return value is a nonzero value (see Error Codes for Database Functions).

See also

DbBof
DbConnect
DbDisconnect
DbEof
DbExecute
DbGetFieldNumeric
DbGetFieldString
DbMove
DbMoveFirst
DbMoveLast
DbMoveNext
DbMovePrev
DbRecordCount
DbSelect

Example

'The example uses a data source name called WinTaskTest which contains those records in a table called DATA:
' a,1, 1.23, 02/01/2011
' b,2, 2.34, 03/02/2012
' c,3, 3.45, 04/12/2009
DbConnect("DSN=WinTaskTest") ' connection to ODBC database called WinTaskTest
DbSelect("SELECT * FROM DATA",DYNASET) ' select all records from DATA table.
DbMoveLast() ' move to last record.
total=DbRecordCount() ' count the number of records.
MsgBox(str$(total)) ' display the record count.
DbClose() ' close the recordset