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?
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?
There's a lot of ways, but one is to use a SQL update statement and parameterized statements.
The above examples are great ones, you could also look at LINQ.
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!