I presently have an inherited sq. declaration written for VBScript that I need to convert to be used in C#. it is at the beginning written for a complete text index seek in VBScript and conventional ASP.
The problem is I believe is with the double rates. right here is the unique announcement…
choose * FROM ejn_ExpandedDescriptions AS FT_TBL inner be part of CONTAINSTABLE(ejn_ExpandedDescriptions, searchindex, ‘""" & txtFormDesc & “*”"’, 50) AS KEY_TBL ON FT_TBL.id = KEY_TBL.[KEY] in which att10=‘current’ ORDER by KEY_TBL.RANK DESC
Observe the usage of double quotes inside the section…
‘""" & txtFormDesc & “*”"’
I need to convert that string to C# and skip a parameter, @txtFormDesc, but the string should encompass the asterisk. here’s a pattern code from what I recognize must be the way to restoration it https://tekslate.com/sql-server-t-sql-training/
USE AdventureWorks2012;
GO
SELECT Name
FROM Production.Product
WHERE CONTAINS(Name, ‘“chain*” OR “full*”’);
GO
From that code i’m assuming there wishes to be double prices within the assertion. i’ve attempted to apply "/ in update of of a double quote but in C# it will not permit me. I also attempted the use of the following code…
pick out txtItemA FROM ejn_ExpandedDescriptions AS FT_TBL inner join CONTAINSTABLE(ejn_ExpandedDescriptions, searchindex, ’ @txtFormDesc" + "*’ , 50) AS KEY_TBL ON FT_TBL.identity = KEY_TBL.[KEY] where att10 = ‘current’ ORDER by using KEY_TBL.RANK DESC
This nonetheless results in mistakes.
If i use this assertion with out an asterisk, it works on single words however not more than one word, (which the above assertion is supposed to do).
pick txtItemA FROM ejn_ExpandedDescriptions AS FT_TBL inner be a part of FREETEXTTABLE(ejn_ExpandedDescriptions, searchindex, @txtFormDesc, 50) AS KEY_TBL ON FT_TBL.identification = KEY_TBL.[KEY] wherein att10=‘cutting-edge’ ORDER through KEY_TBL.RANK DESC
i’ve also attempted this with out a success…
choose txtItemA FROM ejn_ExpandedDescriptions AS FT_TBL internal be a part of CONTAINSTABLE(ejn_ExpandedDescriptions, searchindex, ‘@txtFormDesc" + "*’ , 50) AS KEY_TBL ON FT_TBL.identification = KEY_TBL.[KEY] in which att10 = ‘modern’ ORDER by KEY_TBL.RANK DESC
I want to create another assertion that works in C# this is in a position to tug off the corrected conversion from its original shape in VBScript, to work in C# as a string accepting the paramater @txtFormDesc, using the asterisk.