Boolean won't insert if default is "true"

N

nick

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.
 
N

nick

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.
 
J

Jeffrey Tan[MSFT]

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.
 
N

nick

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.
 
G

Guest

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.
 
N

nick

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/[email protected]

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

Guest

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.
 
N

nick

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.
 
G

Guest

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.
 
Top