Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. help with MySQL dynamic sql

help with MySQL dynamic sql

Scheduled Pinned Locked Moved Database
csharpdatabasemysqlsaleshelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    I am developing C# winForm application. I have a textbox for searchign customer name but I want the user to enter the customer name like this:

    john mathews

    Or:

    Robert Duff

    then in MySQL I want to have a dynamic sql to search search the customer_name like this:

    SELECT * FROM customers WHERE customer_name CONTAINS john AND customer_name CONTAINS mathews

    M L 3 Replies Last reply
    0
    • J Jassim Rahma

      I am developing C# winForm application. I have a textbox for searchign customer name but I want the user to enter the customer name like this:

      john mathews

      Or:

      Robert Duff

      then in MySQL I want to have a dynamic sql to search search the customer_name like this:

      SELECT * FROM customers WHERE customer_name CONTAINS john AND customer_name CONTAINS mathews

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      See the sticky at the top, it tells you how to get an answer to your QUESTION, ou actually need to ask a question rather than make a statement.

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      • J Jassim Rahma

        I am developing C# winForm application. I have a textbox for searchign customer name but I want the user to enter the customer name like this:

        john mathews

        Or:

        Robert Duff

        then in MySQL I want to have a dynamic sql to search search the customer_name like this:

        SELECT * FROM customers WHERE customer_name CONTAINS john AND customer_name CONTAINS mathews

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Get the value of the texbox, split it into a string[] and use the elements of the array as parameters into your SQL query. Note, do not use string concatenation to create your query but proper SQL parameterisation.

        One of these days I'm going to think of a really clever signature.

        J 1 Reply Last reply
        0
        • L Lost User

          Get the value of the texbox, split it into a string[] and use the elements of the array as parameters into your SQL query. Note, do not use string concatenation to create your query but proper SQL parameterisation.

          One of these days I'm going to think of a really clever signature.

          J Offline
          J Offline
          Jassim Rahma
          wrote on last edited by
          #4

          this is in C#.. but can this be done in SQL level?

          L 1 Reply Last reply
          0
          • J Jassim Rahma

            this is in C#.. but can this be done in SQL level?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            In your opening question:

            jrahma wrote:

            I am developing C# winForm application.

            So which is it to be?

            One of these days I'm going to think of a really clever signature.

            1 Reply Last reply
            0
            • J Jassim Rahma

              I am developing C# winForm application. I have a textbox for searchign customer name but I want the user to enter the customer name like this:

              john mathews

              Or:

              Robert Duff

              then in MySQL I want to have a dynamic sql to search search the customer_name like this:

              SELECT * FROM customers WHERE customer_name CONTAINS john AND customer_name CONTAINS mathews

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Invest some time here[^].

              Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups