|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with parameterHere is my code. Dim Bruker As String = Me.AnsattNavn.Text Dim Utfort As Boolean = (True Or False) 'Innboks dgvInnboks.DataSource = InnboksPrBrukerBindingSource Me.InnboksPrBrukerTableAdapter.Fill(Me.MeldingDBsqlDataSet.InnboksPrBruker, Bruker, Utfort) dgvInnboks.Refresh() The problem is that Utfort is returning just one of the two possibilities. Either true or false, not both of them My tableadapter sql is SELECT ToDoID, Dato, Bruker, Melding, MeldingFra, Utfort FROM tblToDo WHERE (Bruker = @Bruker) AND (Utfort = @Utfort) ORDER BY ToDoID DESC When Utfort = true it works, when Utfort = false it works When Utfort = True OR False it does not work. How can I omit the last situation. The field Utfort is set as a bit in the table (sql db) reidarT reidarT,
(True Or False) will always evaluate to True. You can't specify 2 values in a Where clause using the "=" operator. (Utfort = @Utfort) can only accept 1 value. @Utfort can be True or @Utfort can be False. You will need to change your SQL Select statement if you want this much flexibility in specifying values for Utfort. Kerry Moorman Show quoteHide quote "reidarT" wrote: > I still have a probem with a parameter. > Here is my code. > Dim Bruker As String = Me.AnsattNavn.Text > > Dim Utfort As Boolean = (True Or False) > > 'Innboks > > dgvInnboks.DataSource = InnboksPrBrukerBindingSource > > Me.InnboksPrBrukerTableAdapter.Fill(Me.MeldingDBsqlDataSet.InnboksPrBruker, > Bruker, Utfort) > > dgvInnboks.Refresh() > > The problem is that Utfort is returning just one of the two possibilities. > Either true or false, not both of them > > My tableadapter sql is > > SELECT ToDoID, Dato, Bruker, Melding, MeldingFra, Utfort > FROM tblToDo > WHERE (Bruker = @Bruker) AND (Utfort = @Utfort) > ORDER BY ToDoID DESC > > When Utfort = true it works, when Utfort = false it works > > When Utfort = True OR False it does not work. > > How can I omit the last situation. > > The field Utfort is set as a bit in the table (sql db) > > reidarT > > > > > > > > >
How can I make a copy of my collection?
Difference in using "With Me" statement in dotnet VB and access VBA DownloadComplete how to write ? Referencing an Enum with Embedded Spaces Display compiled HTML help file in VB.NET app naive question Bit and boolean Refresh DataGrid How do I paint the combo box dropdown button in a datagridview column |
|||||||||||||||||||||||