Solved

Update db when Event is Triggered

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

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

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses

732 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