473,383 Members | 1,929 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,383 software developers and data experts.

Boolean won't insert if default is "true"

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
8 1691
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

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

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

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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: lawrence | last post by:
In the following loop, at the end, the method debugNotes() is printing out some notes for me to read, so I can figure out what is going on in my script. Where I try to print out the value of the...
1
by: nick | last post by:
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...
4
by: Andy Leszczynski | last post by:
watch this: http://www.turbogears.org.nyud.net:8090/docs/wiki20/20MinuteWiki.mov or read this: http://www.turbogears.org.nyud.net:8090/docs/wiki2 0/page4.html should not it be: 2 def...
4
by: Bradley Plett | last post by:
I have what should be a trivial problem. I am using XMLSerializer to serialize an object. It serializes boolean values as "True" and "False". I then want to use an XSLT on this XML, and I want...
1
by: Edward Yang | last post by:
I setup web.config with impersonation="true". On our local server the project works great. I did the same procedures on our staging server, but it failed with an impossible error: Server Error in...
2
by: Guy Lafleur | last post by:
I have a user control that builds a treeview dynamically in the Page_Load event. Also, I have the AutoEventWireup property set to true (i.e., <%@ Control AutoEventWireup="true" %>). Then, when I...
3
by: Raghuram | last post by:
Hi, What is the use of <Identity Impersonate="true" /> How can we implement this in an ASP.NET application When are we supposed to use this. please provide me the details with an Example....
13
by: Water Cooler v2 | last post by:
What do you mean by a cookieless session state? When you set the sessionState section's cookieless attribute to true in the web.config file, what does that mean? I read this...
3
by: André | last post by:
Hi, I put that question already, but it's still not very clear to me, so ... Assume following option in web.config= debug="false" but in one aspx page (test.aspx) <%@ debug="true" ..%>
9
by: Jamey Bon | last post by:
As a newbie to C#, I am not sure what I can do about this. I would like to do something like an Enumeration to use "constants" like Yes to indicate true and No for false. But since there seems to...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.