In this article , Raman Iyer and Jesper Lind write about a way to add a Web Cross-sell functionality to a ASP.NET page to produce high-quality recommendations.

            Here , I don’t discuss the data mining approach but I try to present a more simple way to use , programmatically , this feature.

            I follow the ideea that say if the system can do a thing better and in time (with or without wizard) than me then let him to do it !

            So , the design of web page is  like  in next image

 

Le me explain what you see:

·        The SqlDataSource named “DMdataSource” is a SQLDataSource object configured like this (The first Wizard): Configure Data Source à New Connection… à Change (from Data Source option) à choose <other> (at “Data Source” list box  ) and “.NET Framework data Provider for OLEDB” (at “”Data Provider” combo box) à In “Add Connection” window choose “Microsoft OLE DB Provider for Data Mining Services” at “OLE DB Provider” combo box à “Server or file name “ and “Location” (complete with your server)à “Log on to the server” (use “Windows NT Integrated Security”) à Initial Catalog (write “Movie Recommandations”- the data mining database) àTest ConnectionàComplete with a DMX command

SELECT flattened topcount(Predict ([Customer Movies],Include_statistics),$AdjustedProbability,5)

from  [Movie Recommendations]

NATURAL PREDICTION JOIN

(SELECT (SELECT 'The Matrix' AS [Movie]

  UNION SELECT 'Toy Story' AS [Movie]) AS [Customer Movies]) AS t

à and Finish

·        In the text box  the user write the name of the movie and the recommandations will be showed as a result of a DMX select in the GridView with “Recommandations” Caption

·        The “Get recomm” command button has the following code:

 

DMDataSource.SelectCommand = "SELECT flattened topcount(Predict ([Customer Movies],Include_statistics),$AdjustedProbability,5) " & _

        " From  [Movie Recommendations] NATURAL PREDICTION JOIN (SELECT (SELECT " _

        & "'" & txtRec.Text & "'" & " AS [Movie]) AS [Customer Movies]) AS t"

 

        DMDataSource.DataBind()

 

        gvRecom.DataBind()

 

 

If you get some simpler than it, please announce me !

 

Gheorghe Ciubuc

 

www.sqlserver.ro