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. General Programming
  3. Visual Basic
  4. sql statement

sql statement

Scheduled Pinned Locked Moved Visual Basic
databasehelp
5 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.
  • M Offline
    M Offline
    magedhv
    wrote on last edited by
    #1

    this is m sql statement SELECT * FROM Persons WHERE FirstName LIKE '%la%' all i need is put a textbox for the user to write anything instead of "la" and i don't know how plz help

    N 1 Reply Last reply
    0
    • M magedhv

      this is m sql statement SELECT * FROM Persons WHERE FirstName LIKE '%la%' all i need is put a textbox for the user to write anything instead of "la" and i don't know how plz help

      N Offline
      N Offline
      Naji El Kotob
      wrote on last edited by
      #2

      Hi, You could simply use the following: Dim strSQL as STring strSQL = "SELECT * FROM Persons WHERE FirstName LIKE '%" & TextBox1.Text & "%'" ... But this is not a secure way, SQL Injection could be possible here! regards, NajiCo http://www.InsideVB.NET[^]

      It's nice 2b important, but it's more important 2b nice...

      M C 2 Replies Last reply
      0
      • N Naji El Kotob

        Hi, You could simply use the following: Dim strSQL as STring strSQL = "SELECT * FROM Persons WHERE FirstName LIKE '%" & TextBox1.Text & "%'" ... But this is not a secure way, SQL Injection could be possible here! regards, NajiCo http://www.InsideVB.NET[^]

        It's nice 2b important, but it's more important 2b nice...

        M Offline
        M Offline
        magedhv
        wrote on last edited by
        #3

        thx

        C 1 Reply Last reply
        0
        • N Naji El Kotob

          Hi, You could simply use the following: Dim strSQL as STring strSQL = "SELECT * FROM Persons WHERE FirstName LIKE '%" & TextBox1.Text & "%'" ... But this is not a secure way, SQL Injection could be possible here! regards, NajiCo http://www.InsideVB.NET[^]

          It's nice 2b important, but it's more important 2b nice...

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          Naji El Kotob wrote:

          But this is not a secure way, SQL Injection could be possible here!

          That much is true. Read: SQL Injection Attacks and Tips on How to Prevent Them[^]


          Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

          1 Reply Last reply
          0
          • M magedhv

            thx

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            As the previous poster mentioned, the solution given is susceptable to SQL Injection Attacks. You should learn to defend yourself from them. Please read SQL Injection Attacks and Tips on How to Prevent Them[^]


            Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

            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