Parameters in selectcommand
-
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
-
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
Please anybody?? :(:sigh:
-
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
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