'Null or empty predicate of the full text when executing the storage procedure from the associated control

I have a page in my ASP.Net application that is used to search for a database through a repository procedure. One of the parameters passed to the saved file is bound to the text field through the ControlParameter binding.

<asp:ControlParameter Name="EventDescription" Type="String" ControlID="ucTestLogSearch" PropertyName="EventDescription" />

The text is passed to the SQL Server stored procedure. A stored procedure defines this parameter:

@event_descrip VARCHAR(200) = NULL,

And it uses the parameter in the WHERE clause as follows:

(CONTAINS (le.event_descrip, @event_descrip) OR @event_descrip IS NULL)

My problem is that if the text field is empty, I get the following exception: 'Zero or empty full text predicate .

In my experience, checking for null in the WHERE clause should be sufficient to prevent this error.

, DB-, . , SQL Server. , , - .

- , , , , ?

+3
1

:

IF ISNULL(@event_descrip,'') = '' SET @event_descrip = '""'; 
+3

Source: https://habr.com/ru/post/1764913/


All Articles