Hello,
I have a little problem (I think).
I have this code to check if a user (the list of users i'll get from the active directory) exists in the SQL table.
If the selected user exists in the SQL table I get the msgbox. But i don't want the know the users who are in the SQL table I want the list of users who don't exists in the SQL table.
But I found out if the user doesn't exists the scripts dont come to:
While SQLdr.Read()
because there is nothing to read.
How can I get the names of those who aren't exists in the SQL table?
I have a little problem (I think).
I have this code to check if a user (the list of users i'll get from the active directory) exists in the SQL table.
VB.NET:
'Read from SQL
SQLStr = "SELECT * FROM table WHERE username='" & dir.Properties("Name").Value & "'"
SQLConn.ConnectionString = ConnString 'Set the Connection String
SQLConn.Open() 'Open the connection
SQLCmd.Connection = SQLConn 'Sets the Connection to use with the SQL Command
SQLCmd.CommandText = SQLStr 'Sets the SQL String
SQLdr = SQLCmd.ExecuteReader 'Gets Data
While SQLdr.Read() 'While Data is Present
SQLfinal = SQLdr("username")
msgbox(SQLfinal)
End While
SQLdr.Close() 'Close the SQLDataReader
SQLConn.Close() 'Close the connection
If the selected user exists in the SQL table I get the msgbox. But i don't want the know the users who are in the SQL table I want the list of users who don't exists in the SQL table.
But I found out if the user doesn't exists the scripts dont come to:
While SQLdr.Read()
because there is nothing to read.
How can I get the names of those who aren't exists in the SQL table?