Answer the question
In order to leave comments, you need to log in
How to search in SQL based on the fullness of the form elements?
Good afternoon, I have several different kinds of databases available, the search in each of them is carried out based on the parameters that the user enters.
The fields are the most common, Surname, First Name, Patronymic, address, and so on, as I most bloodlessly organize a search in the database.
Now I act like this
if (textbox.Text.length<1)
command.parameters.add("@paramert",%);
else
command.parameters.add("@paramert",parametr);
But I think it's not the best way, you need to enumerate all the fields and "collect" consisting of @param1=param1 and @param2=param2 and so on.
Answer the question
In order to leave comments, you need to log in
1) write a storage 2) move the SQL query code into separate classes from the code-behind. 3) Check the form input and call the method passing a set of parameters
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question