Solved

Update db when Event is Triggered

Posted on 2006-10-22
1
185 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need a complete list of ASP.NET page load events 3 26
Syntax error 9 45
Not showing page correctly 3 29
Where can I ask about my ASP.NET MVC project? 6 19
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

919 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