M
Mate
I am trying to execure this query in C#, but I can not. It is well when I
use string with quotes instead @SearchTerm parameter (it is not good because
of SQL Injection).
Can I use full text search ad-hoc query with parameters or I need to use
stored procedures?
This is my code:
SQL = @"SELECT * FROM IndexedPages a JOIN CONTAINSTABLE(IndexedPages,
(Title, PageText), 'ISABOUT(@SearchTerm WEIGHT(.1))') ct ON a.ID = ct.[KEY]
ORDER BY RANK DESC";
myCommand = new SqlCommand(SQL, SqlConn);
myCommand.Parameters.Add(new SqlParameter("@SearchTerm", SearchTerm));
DAdapter.SelectCommand = myCommand;
DSet = new DataSet(); DAdapter.Fill(DSet);
use string with quotes instead @SearchTerm parameter (it is not good because
of SQL Injection).
Can I use full text search ad-hoc query with parameters or I need to use
stored procedures?
This is my code:
SQL = @"SELECT * FROM IndexedPages a JOIN CONTAINSTABLE(IndexedPages,
(Title, PageText), 'ISABOUT(@SearchTerm WEIGHT(.1))') ct ON a.ID = ct.[KEY]
ORDER BY RANK DESC";
myCommand = new SqlCommand(SQL, SqlConn);
myCommand.Parameters.Add(new SqlParameter("@SearchTerm", SearchTerm));
DAdapter.SelectCommand = myCommand;
DSet = new DataSet(); DAdapter.Fill(DSet);