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. Problem with Access SQL

Problem with Access SQL

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestion
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.
  • E Offline
    E Offline
    ecentinela
    wrote on last edited by
    #1

    In a test I'm making I type this oledbDataAdapter.SelectCommand.CommandText = "SELECT * FROM tbl_clientes;" oledbDataAdapter.Fill(Dataset) Me.DataGridBuscar.DataSource = Dataset Then I change the code to oledbDataAdapter.SelectCommand.CommandText = "SELECT * FROM tbl_clientes WHERE nombre LIKE '*j*';" oledbDataAdapter.Fill(Dataset) Me.DataGridBuscar.DataSource = Dataset And nothing is selected!!! If I copy and paste the SQL in the access editor, it returns a few records that begins with "j" (what I want!) Why this not runs in VBNET? Thanks.

    K 1 Reply Last reply
    0
    • E ecentinela

      In a test I'm making I type this oledbDataAdapter.SelectCommand.CommandText = "SELECT * FROM tbl_clientes;" oledbDataAdapter.Fill(Dataset) Me.DataGridBuscar.DataSource = Dataset Then I change the code to oledbDataAdapter.SelectCommand.CommandText = "SELECT * FROM tbl_clientes WHERE nombre LIKE '*j*';" oledbDataAdapter.Fill(Dataset) Me.DataGridBuscar.DataSource = Dataset And nothing is selected!!! If I copy and paste the SQL in the access editor, it returns a few records that begins with "j" (what I want!) Why this not runs in VBNET? Thanks.

      K Offline
      K Offline
      KaptinKrunch
      wrote on last edited by
      #2

      Two things. 1) You say that you want to find records that "START" with J. Do not use a wild card in front of the letter else you will match records that have a j anywhere within the text. 2) Try using % character instead of * character as the wildcard indicator. I have had some luck doing this.

      E 1 Reply Last reply
      0
      • K KaptinKrunch

        Two things. 1) You say that you want to find records that "START" with J. Do not use a wild card in front of the letter else you will match records that have a j anywhere within the text. 2) Try using % character instead of * character as the wildcard indicator. I have had some luck doing this.

        E Offline
        E Offline
        ecentinela
        wrote on last edited by
        #3

        It works like you say... but why in access my query returns values and in VB not? Thanks a lot!

        K 1 Reply Last reply
        0
        • E ecentinela

          It works like you say... but why in access my query returns values and in VB not? Thanks a lot!

          K Offline
          K Offline
          KaptinKrunch
          wrote on last edited by
          #4

          Not sure of the real explanation, but it works. Access does not reconize % as a wildcard. But when passed a sql statement, it works. Crazy Microsoft products...... -- modified at 14:32 Thursday 8th September, 2005

          E 1 Reply Last reply
          0
          • K KaptinKrunch

            Not sure of the real explanation, but it works. Access does not reconize % as a wildcard. But when passed a sql statement, it works. Crazy Microsoft products...... -- modified at 14:32 Thursday 8th September, 2005

            E Offline
            E Offline
            eagertolearn
            wrote on last edited by
            #5

            Yup, that happened to me too with the distinct command. Just make sure you check the syntax if it's compatible with the access. ;)

            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