S
S
Sadus2018-07-30 10:48:58
SQL Server
Sadus, 2018-07-30 10:48:58

How to implement multi-field search in C# + SQL Server?

Hello.
There is a database with a table of patients:
5b5ec27097e13232755101.png
On the form (C#) there are fields for entering a value and searching for records in the table by the given value, with subsequent output to dataGridView1. It is not difficult to implement a search by one of the criteria. But how to make it so that if 2 fields are filled in, I would search accordingly only for two fields (for example, Last Name and Date of Birth) or 3 (by analogy). I would like to get by with some kind of concise solution. without building a huge if else.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sadus, 2018-07-30
@Sadus

I managed to solve the problem with this query:
But maybe there is a more elegant solution?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question