to count records in mysql I put like this:
sql = "SELECT COUNT (*) as Total_Filas FROM " + table
where table is a variable that contains the name of the table.
but as I can do to show me in a msgbox total_filas the value of the variable?
Can anybody help me.
Thank you so much.
sql = "SELECT COUNT (*) as Total_Filas FROM " + table
dim rs as recordset = db.sqlselect(sql)
if rs <> nil then
msgbox “There are " str(rs.idxfield(1).IntegerValue) + " records”
end if
You need to read the value using a RecordSet. Here is some psuedo-code:
Dim count As Integer
Dim results As RecordSet = DB.SQLSelect(sql)
If results <> Nil And Not results.EOF Then
count = results.IdxField(1).IntegerValue
End If