tags:

views:

45

answers:

4

i apologize in advance for the elementary questions

i am using:

command.CommandText = "select * from some_table;"

to retrieve data

can i do use the same thing to update data?

+1  A: 

Here are some simple examples on reading and writing to a database.

amelvin
+1  A: 

There's a lot of ways, but one is to use a SQL update statement and parameterized statements.

Matthew Flaschen
+1  A: 

The above examples are great ones, you could also look at LINQ.

http://msdn.microsoft.com/en-us/library/bb399398.aspx

Steven Dorfmeister
+1  A: 

I assume that command is an instance of SqlCommand. In which case, yes you can. Here is a code fragment detailing what you should do to update data:

command.Connection = (Insert connection string here);
command.CommandText = (Insert update statement);
int numRowsUpdated = command.ExecuteNonQuery();

As I type three answers came in. No need to apologize; we're happy to help!

Jimmy W