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. C#
  4. Parameters in selectcommand

Parameters in selectcommand

Scheduled Pinned Locked Moved C#
csharphelptutorialquestion
3 Posts 2 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.
  • R Offline
    R Offline
    Rmokkenstorm
    wrote on last edited by
    #1

    I have a problem I'm busy writing a C#.NET project but walked into a problem. I've got a Form With 3 Textboxes a Button and a DataGrid. If i typ a value into the textboxes and i press the button. The datagrid Shows me the correct data. the Selectcommand: Select colom1, colum2, colom3, colom4, colom5 From Tabel1 Where (Colom1 = :param2) and (Colom2 = :param3) and (Colom3 = :param4) But now i want it like This: If i Typ a value for the first and last colom and nog the second one. I still want him te show me the data he found. If i do this now he says that he haven't got enough info to fill op my dataAdaptor. Wich is logic. But i realy don't have a clue how to do this.. can you help me? -- modified at 6:33 Friday 17th February, 2006

    R J 2 Replies Last reply
    0
    • R Rmokkenstorm

      I have a problem I'm busy writing a C#.NET project but walked into a problem. I've got a Form With 3 Textboxes a Button and a DataGrid. If i typ a value into the textboxes and i press the button. The datagrid Shows me the correct data. the Selectcommand: Select colom1, colum2, colom3, colom4, colom5 From Tabel1 Where (Colom1 = :param2) and (Colom2 = :param3) and (Colom3 = :param4) But now i want it like This: If i Typ a value for the first and last colom and nog the second one. I still want him te show me the data he found. If i do this now he says that he haven't got enough info to fill op my dataAdaptor. Wich is logic. But i realy don't have a clue how to do this.. can you help me? -- modified at 6:33 Friday 17th February, 2006

      R Offline
      R Offline
      Rmokkenstorm
      wrote on last edited by
      #2

      Please anybody?? :(:sigh:

      1 Reply Last reply
      0
      • R Rmokkenstorm

        I have a problem I'm busy writing a C#.NET project but walked into a problem. I've got a Form With 3 Textboxes a Button and a DataGrid. If i typ a value into the textboxes and i press the button. The datagrid Shows me the correct data. the Selectcommand: Select colom1, colum2, colom3, colom4, colom5 From Tabel1 Where (Colom1 = :param2) and (Colom2 = :param3) and (Colom3 = :param4) But now i want it like This: If i Typ a value for the first and last colom and nog the second one. I still want him te show me the data he found. If i do this now he says that he haven't got enough info to fill op my dataAdaptor. Wich is logic. But i realy don't have a clue how to do this.. can you help me? -- modified at 6:33 Friday 17th February, 2006

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #3

        What is the database, SQL Server? I have done optional search parameters like this

        CREATE PROCEDURE MySearch
         @Param1 VARCHAR(50),
         @Param2 VARCHAR(50)
        AS
        SELECT 
        COl1, Col2
        FROM MyTable
        WHERE Col1=CASE LEN(ISNULL(@Param1,'')
                      WHEN 0 THEN Col1
                      ELSE @Param1
                   END
        AND Col2=CASE LEN(ISNULL(@Param2,'')
                      WHEN 0 THEN Col2
                      ELSE @Param2
                   END
        
        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