update a table

  • Thread starter Thread starter wild wolf
  • Start date Start date
W

wild wolf

Guest
hello,

can someone direct me towards a tutorial where i can learn on how to update a table. the book that i have (C# and the .NET framework) provides a very complex solution to this. iam using an SQL server.

thanx
asrar
 
Do you have a dataset and a dataadapter? Ill assume that you do for now, and that they are both configured properly. After you make your assignments like:

row.item("FIELD_NAME") = "VALUE"

use this:

AdapterName.Update(DataSet)

You need this because when you first make the assignment, only the adapter is updated. You have to manually update the database.

Hope that helps, Im very new at this myself.
Kevin
 
hi, thanx for the suggestion, manged to do using the SqlCommand stuff
Code:
command.CommandText = "UPDATE Item SET " +
				"title = " + b +
				", type = " + type_combo.getSelectedItem() +
				", location = " + l +
				", author = " + j +
				", year = " + g +
				", subject_area = " + k +
				", permission = " + type_combo.getSelectedItem() +
				" WHERE item_id = " + a + "";
command.ExecuteNonQuery();

thanx anyway

asrar
 
Back
Top