In my application i am writing inline query to retrieve data from data base. not using stored procedure. One of my search functionality i am passing two parameter Firstname and lastname , If user not passing one of the parameter no need to include that parameter in query . we achieve ths in procedure using (@EmployeeId IS NULL OR EmployeeID = @EmployeeID) this code. But same thing how will achieve with c#?
public void search( string firstName, string lastName)
{
string sqlquery=" select * from tablename where FirstName="+firstName and // If lastname not empty then only need to add in query
}