A
Alex
I am using a web service to update some database fields. I used the
dataset designer to define my datatable and tableadapter. I had it
automatically create the insert, update, and delete statements.
When I run the update method, all of the fields are updated except for
four datetime fields. Another attribute these fields have in common is
that they allow nulls. When the method runs, the values in the fields
are not overwritten, they are simply not changed.
Here is the code used for the updating:
PurchaseOrderTableAdapter dAdapter = new PurchaseOrderTableAdapter();
PoDataSet.PurchaseOrderDataTable ds =
dAdapter.GetDataByPoID(poID);
foreach (PoDataSet.PurchaseOrderRow dataRow1 in ds)
{
dataRow1["PONumber"] = poNumber;
dataRow1["ConfirmingTo"] = confirmingTo;
dataRow1["poDate"] = poDate;
dataRow1["ReqDate"] = reqDate;
dataRow1["CancelDate"] = cancelDate;
dataRow1["AllowBackOrder"] = allowBackOrder;
dataRow1["ShipTo"] = shipTo;
dataRow1["BillTo"] = billTo;
dataRow1["ShipVia"] = shipVia;
dataRow1["FOBPoint"] = fobPoint;
dataRow1["Terms"] = terms;
dataRow1["IsPlaced"] = isPlaced;
dataRow1["placeDate"] = datePlaced;
}
try
{
dAdapter.Update(ds);
}
catch (Exception e)
{
return 1 + e.Message;
}
return "0";
I am new to C# and .net in general. Any ideas as to why this method is
not updating the "placeDate", "poDate", "ReqDate", and "CancelDate"
fields? The variables used are defined as DateTime types. As I said,
there are no errors flagged during the process.
Your advice is greatly appreciated.
-- Alex
dataset designer to define my datatable and tableadapter. I had it
automatically create the insert, update, and delete statements.
When I run the update method, all of the fields are updated except for
four datetime fields. Another attribute these fields have in common is
that they allow nulls. When the method runs, the values in the fields
are not overwritten, they are simply not changed.
Here is the code used for the updating:
PurchaseOrderTableAdapter dAdapter = new PurchaseOrderTableAdapter();
PoDataSet.PurchaseOrderDataTable ds =
dAdapter.GetDataByPoID(poID);
foreach (PoDataSet.PurchaseOrderRow dataRow1 in ds)
{
dataRow1["PONumber"] = poNumber;
dataRow1["ConfirmingTo"] = confirmingTo;
dataRow1["poDate"] = poDate;
dataRow1["ReqDate"] = reqDate;
dataRow1["CancelDate"] = cancelDate;
dataRow1["AllowBackOrder"] = allowBackOrder;
dataRow1["ShipTo"] = shipTo;
dataRow1["BillTo"] = billTo;
dataRow1["ShipVia"] = shipVia;
dataRow1["FOBPoint"] = fobPoint;
dataRow1["Terms"] = terms;
dataRow1["IsPlaced"] = isPlaced;
dataRow1["placeDate"] = datePlaced;
}
try
{
dAdapter.Update(ds);
}
catch (Exception e)
{
return 1 + e.Message;
}
return "0";
I am new to C# and .net in general. Any ideas as to why this method is
not updating the "placeDate", "poDate", "ReqDate", and "CancelDate"
fields? The variables used are defined as DateTime types. As I said,
there are no errors flagged during the process.
Your advice is greatly appreciated.
-- Alex