checkbox vaule in sql quary
-
Dienstag, 13. März 2012 17:00
Can you look at this quary :
DB.GetDataSet("select '' as Item, sum((bolordqty * bolordweight) + bolordunitwt) as Weight, sum(bolordpk) as Package, sum(convert(int,bolordqty)) as Qty, convert(bit,0) as bolordhz, '' as bolorduom, bolordtype, sum(bolordunit) as bolordunit, '' as bolordunittype, '' as bolordaddinfo, bolordpackgroup from bolorderinfo where bolorddocid = '" & TxtDocNo.Text.Trim & "' and bolordpackgroup <> 0 group by bolordtype, bolordpackgroup union all "
Here "bolordhz" is checkbox. Problem is even i check the check box ..i am getting the value from that quary is false.i hope because of convert(bit,0) ...is wrong
if i change convert(bit,1)..then it is alwayes showing true value even i did not check checkbox.
How to i figure out based on my checkbox value.
kavitha
Alle Antworten
-
Dienstag, 13. März 2012 20:14
hi kavitha
well, your query is hard to follow, but are you simply trying to get whether a CheckBox is checked or not? you can get it with the Checked property
try this in an app with a button and a checkbox. Each time you click the button, it changes the checked state and displays whether it is Checked (True) or not Checked (False)
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click CheckBox1.Checked = Not CheckBox1.Checked MessageBox.Show("Checked is " & CheckBox1.Checked) End Sub- Als Antwort markiert Shanks ZenMicrosoft Contingent Staff, Moderator Mittwoch, 4. April 2012 08:31
-
Dienstag, 13. März 2012 21:56
I can only guess that somewhere in your DB.GetDataSet you need to use SqlDbType.Bit to tell it to convert from an SQL bit datatype to a .NET Boolean.
--
Andrew

