Automating QTP Test Automation Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map
SQL Function - ExistsThis function checks if a row exists. Download it Here (right-click and then save target as). (NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).
'=========================================================================
Function zSql_Exists(sDsn,sSql) Dim oCon, oRec Set oCon=CreateObject("ADODB.Connection") Set oRec=CreateObject("ADODB.Recordset") oCon.Open ("DSN=" & sDsn) oRec.Open sSQL,oCon If oRec.Eof Then zSql_Exists = False Else zSql_Exists = True End If oRec.Close oCon.Close Set oRec=Nothing Set oCon=Nothing End Function '========================================================================= |