Doesn't update my database
Hi everyone,
the code below still doesn't update my database
//Fill a dataset with values
CSOAIS.BACKEND.DATASETS.ItemDatasetTableAdapters.ItemTableAdapter ItemAdapter;
ItemAdapter = new CSOAIS.BACKEND.DATASETS.ItemDatasetTableAdapters.ItemTableAdapter();
CSOAIS.BACKEND.DATASETS.ItemDataset ItemDS = new CSOAIS.BACKEND.DATASETS.ItemDataset();
ItemDS.DataSetName = "ItemDataset";
ItemDS.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
ItemAdapter.Fill(ItemDS.Item);
//Auto generate item code
txtIcode.Text = this.GenerateCode(ItemDS.Item, "ITM-");
// Create a new row.
CSOAIS.BACKEND.DATASETS.ItemDataset.ItemRow NewItemRow;
NewItemRow = ItemDS.Item.NewItemRow();
NewItemRow.ItemCode = this.GenerateCode(ItemDS.Item, "ITM-");
NewItemRow.ItemName = this.txtIname.Text;
NewItemRow.ItemDesc = this.txtIdesc.Text;
NewItemRow.CategoryCode = (string)this.cmboCategory.Text;
NewItemRow.SubCategoryCode = (string)this.cmboSubCat.Text;
NewItemRow.UnitMeasureCode = (string)this.cmboUM.Text;
//set default values
NewItemRow.LocationCode = "CSO";
NewItemRow.StatusCode = "Active";
// Add the row to the Item table
ItemDS.Item.Rows.Add(NewItemRow);
// Save the new row to the database
this.itemTableAdapter.Update(ItemDS.Item);
this.itemTableAdapter.Connection.Close();