searching article for names in the database before submitting article to the database
- by zurna
I want to create a function that will search through a text, find names those match with existing names in the database and add links to those names before submitting the article to the database.
i.e.
text:
Chelsea are making a change now as goalscorer Nicolas Anelka is replaced by in-form Florent Malouda who can do no wrong lately.
Nicolas Anelka exists in the database in the Players table with ID column equals to 1.
I want text to be converted to
Chelsea are making a change now as goalscorer Nicolas Anelka is replaced by in-form Florent Malouda who can do no wrong lately.
I know my code is logically wrong but I could build the correct logic.
Function PlayerStats (ArticleDesc)
If IsNull(ArticleDesc) Then Exit Function
SQL = "SELECT PlayerID, PlayerName"
SQL = SQL & " FROM Players"
SQL = SQL & " WHERE PlayerID = "& &""
Set objTeam = objConn.Execute(SQL)
ArticleDesc = Replace(ArticleDesc, "&", "&")
PlayerStats = ArticleDesc
End Function