Selecting with SqlDataSource and default value of empty string

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
 
G

Guest

Is the SQLDataSource converting the empty string parameter to NULL ?

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top