Selecting with SqlDataSource and default value of empty string

  • Thread starter Thread starter jw56578
  • Start date Start date
J

jw56578

If I have a parameter with a default value of empty string, the
sqldatasource won't even execute the command on sql server. Im using a
"like" clause so i want to include an empty string to retrieve all
records if desired.

the command would look like this

exec sp_executesql N'SELECT * FROM [cfgProduct] WHERE ([name] LIKE
''%'' + @name + ''%'')', N'@name nvarchar(4)', @name = N''

But it just won't execute anything when the assigned paramter is empty
string.
how might this be resolved?
thanks
 
Is the SQLDataSource converting the empty string parameter to NULL ?

Each parameter has an advanced property ConvertEmptyStringToNull which
defaults to true..
 
Back
Top