Just starting to look at ASP and have got a stupid problem. when using the following code, i am not getting the expected value returned.
strGetMax ="Select MAX(NewsID) as maxID FROM tblNews
objCheck.Open strGetMax
if ((objCheck.RecordCount = 0) OR (objCheck("maxID"
=""
) then
maxIDVal =1
else
maxIDVal = objCheck("maxID"
+1
end if
when there are no records in the table, nothing is assigned to maxIDVal, when there is a record in the database it works fine. quite where this null value is coming from i don't know ! I have found that i am getting a -1 returned as the recordcount when there are no records in the db. any ideas ?
strGetMax ="Select MAX(NewsID) as maxID FROM tblNews
objCheck.Open strGetMax
if ((objCheck.RecordCount = 0) OR (objCheck("maxID"
maxIDVal =1
else
maxIDVal = objCheck("maxID"
end if
when there are no records in the table, nothing is assigned to maxIDVal, when there is a record in the database it works fine. quite where this null value is coming from i don't know ! I have found that i am getting a -1 returned as the recordcount when there are no records in the db. any ideas ?