Solved

Update db when Event is Triggered

Posted on 2006-10-22
1
184 Views
Last Modified: 2010-04-16
I would like to use a button to update a bool field in a dB, using a SqlDataSourse.
The default value in the dB is ‘0’ I would like the button click event to change it to ‘1’.
The SqlDataSourse is set to ‘Select *’ for the table name.

Could someone show me how to do this, in C#?

In other words, i would like the dB to be updated when a event is triggered.

Thanks for any help in advance.  
0
Comment
Question by:bmanmike39
1 Comment
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 17788034
System.Data.SqlClient.SqlConnection ACo  =
                        new System.Data.SqlClient.SqlConnection(UrConnectionString);
                  ACo.Open();
                  string Query = "Update table set somethig = 'test' where anothersomething = 'avalue'";
                  System.Data.SqlClient.SqlCommand ACommand =

                        new System.Data.SqlClient.SqlCommand(Query,ACo);
                  ACommand.ExecuteNonQuery();
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now