473,406 Members | 2,404 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,406 software developers and data experts.

Programmatically using SqlDataSource

hey all,

i have the following statement:

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{

SqlDataSource1.UpdateParameters["FollowUp"].DefaultValue=((CheckBox)sender).Checked?"1":"0";
SqlDataSource1.Update();
}

Regarding what i assigned the parameter's default value: the "FollowUp"
field in the database is a bit. I noticed if I used .Checked?true:false it
didin't work because you can't convert bool to string. But i thought it was a
bool in the database?

just needing some help in understanding.

thanks,
rodchar
Jun 11 '07 #1
3 4334
On Jun 11, 10:17 pm, rodchar <rodc...@discussions.microsoft.com>
wrote:
hey all,

i have the following statement:

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{

SqlDataSource1.UpdateParameters["FollowUp"].DefaultValue=((CheckBox)sender)*.Checked?"1":"0";
SqlDataSource1.Update();
}

Regarding what i assigned the parameter's default value: the "FollowUp"
field in the database is a bit. I noticed if I used .Checked?true:false it
didin't work because you can't convert bool to string. But i thought it was a
bool in the database?
Bit is an integer data type and can be used to store 0, 1, or NULL.

Jun 11 '07 #2
but when you go into management studio you put a true or false right?

"Alexey Smirnov" wrote:
On Jun 11, 10:17 pm, rodchar <rodc...@discussions.microsoft.com>
wrote:
hey all,

i have the following statement:

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{

SqlDataSource1.UpdateParameters["FollowUp"].DefaultValue=((CheckBox)sender)-.Checked?"1":"0";
SqlDataSource1.Update();
}

Regarding what i assigned the parameter's default value: the "FollowUp"
field in the database is a bit. I noticed if I used .Checked?true:false it
didin't work because you can't convert bool to string. But i thought it was a
bool in the database?

Bit is an integer data type and can be used to store 0, 1, or NULL.

Jun 12 '07 #3
On Jun 12, 3:16 pm, rodchar <rodc...@discussions.microsoft.comwrote:
but when you go into management studio you put a true or false right?
Right, and I don't know why they decided to convert sql-bit to ".Net
Framework Data Type: Boolean" in a table browser of the management
studio.

I think many people are confused over the difference between True/
False and 1/0

Anyhow, use 0, or 1 to define a bit value (in this case it will be
compatible with SQL 2000).
Or use 'True', or 'False' (in apostrophes)

Jun 12 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: fuchs.markus | last post by:
Hello, on my page, I have a DetailsViewControl connected to a SqlDataSource. Now when I dynamically set the FilterExpression and FilterParameters - for example in a OnClick-EventHandler of a...
5
by: Brian McClellan | last post by:
Just wondering if anyone has a simple example of creating a gridview completely programmatically, i'm not doing anything terribly sophisticated. When creating the gridview declaratively evertying...
1
by: RHIZOME | last post by:
I am reparameterizing a SqlDataSource programmatically, using runtime events. This works nicely for on-the-fly search, but sorting and paging are using the original (declared) version of my...
0
by: pxpilot | last post by:
Hi Guys, I have this SqlDataSource, that counts some records and sets it in "NotStartedBugs". How do I retrive "NotStartedBugs" programmatically? <asp:SqlDataSource ID="SqlDataSource3"...
10
by: perplexed | last post by:
After a user logs in (ASP.NET 2.0 membership/roles), how do I programmatically access their UserId and other information stored in the ASP.NET database structure? A user may login at Login.aspx...
1
by: Vili | last post by:
Hi all I would like to get some ideas and opinions of my solution for dataconnection on asp.net 2.0 I have created a class which encapsulates the sqldatasource usage. With my class one can...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
0
by: Bart | last post by:
Hi, i want to programmatically manipulate the property 'Name' of a ControlParameter inside a InsertParameters tag. This the aspx code: ------------------ <asp:SqlDataSource...
3
by: =?Utf-8?B?QW5nZWw=?= | last post by:
I seem to understand how the control works as long as I mated to SqlDataSource or ObjDataSource it works fine. But I do not want to flatten my design in this manner. I am interested in how I can...
6
by: tshad | last post by:
I was looking at a page that showed how to set up a custom event and it seems to work ok. But I am not sure how I would use it. How would I subscribe to it. There is actual action (such as...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.