By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,836 Members | 2,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,836 IT Pros & Developers. It's quick & easy.

Boolean won't insert if default is "true"

P: n/a
Hi

What is the proper way of setting a boolean column (checkbox) to
"true" by default? It seems that the datagrid won't accept inserts if
the default is true.

BoolColPaid = new DataGridBoolColumn();
BoolColPaid.MappingName = "paid";
BoolColPaid.HeaderText = "paid";
BoolColPaid.FalseValue = false;
BoolColPaid.TrueValue = true;
BoolColPaid.AllowNull = false;
BoolColPaid.NullText = true.ToString();
BoolColPaid.NullValue = true;

Here's defining the dataset's paid column:
<xs:element name="paid" type="xs:boolean" minOccurs="0" />

Here's setting the paid column's default to true:
dataset1.Tables[0].Columns["paid"].DefaultValue = true;

I'm using Access database.
Nov 15 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On Fri, 13 Feb 2004 16:35:19 +1300, nick <no@no.com> wrote:
Hi

What is the proper way of setting a boolean column (checkbox) to
"true" by default? It seems that the datagrid won't accept inserts if
the default is true.

BoolColPaid = new DataGridBoolColumn();
BoolColPaid.MappingName = "paid";
BoolColPaid.HeaderText = "paid";
BoolColPaid.FalseValue = false;
BoolColPaid.TrueValue = true;
BoolColPaid.AllowNull = false;
BoolColPaid.NullText = true.ToString();
BoolColPaid.NullValue = true;

Here's defining the dataset's paid column:
<xs:element name="paid" type="xs:boolean" minOccurs="0" />

Here's setting the paid column's default to true:
dataset1.Tables[0].Columns["paid"].DefaultValue = true;

I'm using Access database.

Sorry it was something else.
Nov 15 '05 #2

P: n/a

Hi Nick,

Thank you for posting in the community!

Based on my understanding, you use datagrid to do databinding. You want to
implement that everytime the user click a new row, the bool column default
is checked.

===========================================
Based on my research, I found that your code should have no problem. I do
like this, and it works well:

private void Form1_Load(object sender, System.EventArgs e)
{
sqlDataAdapter1.Fill(dataSet11.Tables[0]);
dataSet11.Tables[0].Columns["boolfield"].DefaultValue=true;
dataGrid1.DataSource= dataSet11.Tables[0];
}

Can you show me your problem?

You may provide me the steps to reproduce your issue, I will help you.

==========================================

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #3

P: n/a
On Fri, 13 Feb 2004 08:59:59 GMT, v-*****@online.microsoft.com
("Jeffrey Tan[MSFT]") wrote:

Hi Nick,

Thank you for posting in the community!

Based on my understanding, you use datagrid to do databinding. You want to
implement that everytime the user click a new row, the bool column default
is checked.

===========================================
Based on my research, I found that your code should have no problem. I do
like this, and it works well:

private void Form1_Load(object sender, System.EventArgs e)
{
sqlDataAdapter1.Fill(dataSet11.Tables[0]);
dataSet11.Tables[0].Columns["boolfield"].DefaultValue=true;
dataGrid1.DataSource= dataSet11.Tables[0];
}

Can you show me your problem?

You may provide me the steps to reproduce your issue, I will help you.

==========================================


No worries, it's me identifying the wrong cause for the problems. It's
all worked out now. BTW, can I email you a sample project for you to
have a look at a nagging problem? I have the project rar'd to about
1.5mb.
Nov 15 '05 #4

P: n/a

Hi Nick

Thanks very much for your feedback.

For your concern, I suggest you post your problem in this group.

You may pasted the problem reproduce code snippet, also, the clear
description of your issue.

The reason why we recommend posting appropriately is you will get the most
qualified pool of respondents, and other partners who the newsgroups
regularly can either share their knowledge or learn from your interaction
with us.

Thank you for your understanding, I will try my best to help you.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #5

P: n/a
On Mon, 16 Feb 2004 08:15:49 GMT, v-*****@online.microsoft.com
(""Jeffrey Tan[MSFT]"") wrote:

Hi Nick

Thanks very much for your feedback.

For your concern, I suggest you post your problem in this group.

You may pasted the problem reproduce code snippet, also, the clear
description of your issue.

The reason why we recommend posting appropriately is you will get the most
qualified pool of respondents, and other partners who the newsgroups
regularly can either share their knowledge or learn from your interaction
with us.

Thank you for your understanding, I will try my best to help you.
Check out this thread:
http://groups.google.co.nz/groups?hl...o8mu%404ax.com

I've sent over the sample project to Tian Min about 3 days now but
hasn't yet got any reply of possible solution.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Nov 15 '05 #6

P: n/a

Hi nick,

Thanks very much for your feedback.

I have seen this thread, also, I have talked with my colleague "Tian Min
Huang", he is still monitoring this thread and doing research now.
He will help you on it.

Please wait for a little more time.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #7

P: n/a
On Tue, 17 Feb 2004 02:46:55 GMT, v-*****@online.microsoft.com
(""Jeffrey Tan[MSFT]"") wrote:

Hi nick,

Thanks very much for your feedback.

I have seen this thread, also, I have talked with my colleague "Tian Min
Huang", he is still monitoring this thread and doing research now.
He will help you on it.


Yeah just got acknowledgement from him too. Thanks guys for the help.
Waiting for your good news.

Nov 15 '05 #8

P: n/a

Hi Nick,

I am glad you have got acknowledgement from him. I think he will try his
best to help you.

If you have any further concern about C#, please feel free to post in this
group. I will help you.

Thanks,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.