Check Boxes

  • Thread starter Thread starter Vayse
  • Start date Start date
V

Vayse

Hi
I read that Binary in SQL is the equivalent of Yes/No field in Access.
Yet I can't get a check box to the update the binary field. How do I go
about this?
Thanks
Diarmuid
 
Close, but no cigar. :)

A "bit" field in SQL is the equivalent of a Yes/No, not "binary". Try that,
and let us know if there are any problems.


Rob
 
hehe.
Thanks, that fixed it.

Robert Morley said:
Close, but no cigar. :)

A "bit" field in SQL is the equivalent of a Yes/No, not "binary". Try
that, and let us know if there are any problems.


Rob
 
Acutally, I have one more question.
The table won't accept True as a default value. What should I be using?
Thanks
Diarmuid
 
Yeah, that's another annoying thing about SQL...try using 1 instead, that'll
do it.


Rob
 
Thought I had this working, but turns out I don't.
I set the defaults in SQL. If I add new entries to the table via Entreprise
Manager, the defaults are ok.
If I add from my ADP, all the values stay at false!
Below is a test script to show what I mean.
I two different results
A) SQL
I go to Entreprise Manager, do Open Table, return all rows. Add new entries.
BooleanB and BooleanC will be True.

B) ADP
Open the aaaTable in my ADP, add new rows, all 3 Boolean values will be
False.

This is doing my head in!
Any help appreciated.
Diarmuid




if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[aaaTable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[aaaTable]
GO

CREATE TABLE [dbo].[aaaTable] (
[MessID] [int] IDENTITY (1, 1) NOT NULL ,
[BooleanA] [bit] NULL ,
[BooleanB] [bit] NULL ,
[BooleanC] [bit] NULL ,
[MessText] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
 
I think ADP might allow you to save different defaults than the table does.
Try designing the table in ADP and see if it shows something different.
Also, for bit fields, use 1 or 0 as your default value, if you're not
already. SQL Server seems to think TRUE is a reserved word in some places,
but doesn't actually use it in most...I've yet to figure out when/why it's
valid and when not.

That's all that comes to mind off-hand. Good luck!



Rob

Vayse said:
Thought I had this working, but turns out I don't.
I set the defaults in SQL. If I add new entries to the table via
Entreprise Manager, the defaults are ok.
If I add from my ADP, all the values stay at false!
Below is a test script to show what I mean.
I two different results
A) SQL
I go to Entreprise Manager, do Open Table, return all rows. Add new
entries. BooleanB and BooleanC will be True.

B) ADP
Open the aaaTable in my ADP, add new rows, all 3 Boolean values will be
False.

This is doing my head in!
Any help appreciated.
Diarmuid




if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[aaaTable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[aaaTable]
GO

CREATE TABLE [dbo].[aaaTable] (
[MessID] [int] IDENTITY (1, 1) NOT NULL ,
[BooleanA] [bit] NULL ,
[BooleanB] [bit] NULL ,
[BooleanC] [bit] NULL ,
[MessText] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

Robert Morley said:
Yeah, that's another annoying thing about SQL...try using 1 instead,
that'll do it.


Rob
 
Thanks. I'm using 1 or 0.
The defaults worked correctly when I added a record through ADO code.Which
is what I going to do anyway.
Its just didn't work when I added through double clicking on the table in
the ADP.
So its ok for now, as I'm using ADO. I'll have to give it another look,
after taking a little break.
Diarmuid


Robert Morley said:
I think ADP might allow you to save different defaults than the table does.
Try designing the table in ADP and see if it shows something different.
Also, for bit fields, use 1 or 0 as your default value, if you're not
already. SQL Server seems to think TRUE is a reserved word in some places,
but doesn't actually use it in most...I've yet to figure out when/why it's
valid and when not.

That's all that comes to mind off-hand. Good luck!



Rob

Vayse said:
Thought I had this working, but turns out I don't.
I set the defaults in SQL. If I add new entries to the table via
Entreprise Manager, the defaults are ok.
If I add from my ADP, all the values stay at false!
Below is a test script to show what I mean.
I two different results
A) SQL
I go to Entreprise Manager, do Open Table, return all rows. Add new
entries. BooleanB and BooleanC will be True.

B) ADP
Open the aaaTable in my ADP, add new rows, all 3 Boolean values will be
False.

This is doing my head in!
Any help appreciated.
Diarmuid




if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[aaaTable]') and OBJECTPROPERTY(id, N'IsUserTable') =
1)
drop table [dbo].[aaaTable]
GO

CREATE TABLE [dbo].[aaaTable] (
[MessID] [int] IDENTITY (1, 1) NOT NULL ,
[BooleanA] [bit] NULL ,
[BooleanB] [bit] NULL ,
[BooleanC] [bit] NULL ,
[MessText] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

Robert Morley said:
Yeah, that's another annoying thing about SQL...try using 1 instead,
that'll do it.


Rob

Acutally, I have one more question.
The table won't accept True as a default value. What should I be using?
Thanks
Diarmuid
 
Back
Top