Fadi alfadi

Fadi alfadi

  • NA
  • 27
  • 6.7k

How to write Advanced Search and or value

Mar 1 2015 5:08 AM
How to write SP Search  value from multi textbox and dropdownlist and some textboxes  value are empty:

 like: search by title and or actor and or DirectorName


  title <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
 <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
 

SELECT movies.movie_Id, movies.title, movies.image, Movie_Directors.DirectorName

           

FROM            movies INNER JOIN

                         Movie_Directors ON movies.movie_Id = Movie_Directors.movie_Id CROSS

WHERE        (movies.title = "" or movies.title LIKE '%' + @title + '%') and (movies.actor= "" or movies.actor LIKE '%' + @actor+ '%')and (Movie_Directors.DirectorName= "" or Movie_Directors.DirectorName LIKE '%' + @DirectorName+ '%')

Group by DirectorName




c#:

protected void LinkButton1_Click(object sender, EventArgs e)
    {
       
           
            string title = TextBox1.Text;
         string actor = TextBox2.Text;
         string  DirectorName = TextBox3.Text;
          
           
            Repeater1.DataSource = dc.StoredProcedure1(TextBox1.Text, TextBox2.Text, TextBox3.Text);
            Repeater1.DataBind();
            GridView1.DataBind();
    }

please help me

Answers (2)