?
Solved

Update db when Event is Triggered

Posted on 2006-10-22
1
Medium Priority
?
191 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 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