473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem with parameter

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.MeldingDBsq lDataSet.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


Sep 10 '06 #1
1 864
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
"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.MeldingDBsq lDataSet.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


Sep 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mario | last post by:
Hi all From the data-structure below I want to make a table with the following datas RNG@name theName1 RNG/PARAMETER/TEST@name Test1 ...
4
by: Leslaw Bieniasz | last post by:
Cracow, 20.09.2004 Hello, I need to implement a library containing a hierarchy of classes together with some binary operations on objects. To fix attention, let me assume that it is a...
8
by: intrepid_dw | last post by:
Hello, all. I've created a C# dll that contains, among other things, two functions dealing with byte arrays. The first is a function that returns a byte array, and the other is intended to...
5
by: Jason Huang | last post by:
Hi, The SqlParameter myPM =new SqlParameter("@Address", txtAddress.Text) is working for update, but SqlParameter myPM =new SqlParameter ("@Address",SqlDbType.NVarChar,90,txtAddress.Text) is...
2
by: guanfenglin | last post by:
Hello, I have a grid view which display and updates the data, however it doesn't work well, I always either get invalid name/number or not all varaibles bound, I am very frustrated at the...
0
by: le0 | last post by:
Guys, I create a simple insertion in a database using DetailsView control, when i run this page and try to insert some data, the browser returns an error like this ...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
10
by: Constantine AI | last post by:
Hi i am having a little problem with an equation function that was created from all your help previously. The function works fine itself but with a small glitch within it. Here is the function...
8
by: DanicaDear | last post by:
I have something interesting...looking to see if anyone else has came across this. I have a query with parameter and and the query works beautifully every time. However, when I use the wizard...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.