Ok I am doing a check to see if a name is in a database or not. Returns true if it is, false if it isn't there..
Is the following code the best practical way to do this or is there a better way and I'm being clueless?
VB Code:
Private Function IsAccount(ByVal strSQL As String) As Boolean Dim oConn As OleDbConnection = New OleDbConnection(sConn) Dim cmd As OleDbCommand = New OleDbCommand(strSQL, oConn) Dim r As OleDbDataReader = Nothing Dim retValue As Boolean = True Try 'Open the connection oConn.Open() 'Get the reader r = cmd.ExecuteReader 'Check to see if this account name exists If (r.Read) Then retValue = True Else retValue = False End If Catch ex As Exception retValue = True Finally If (Not r Is Nothing) Then r.Close() oConn.Close() End Try Return retValue End Function
Any insight, critisizm, or general "You should'nt do it that way" or "Here's a better way" comments are all welcomed...
