Date fields not upating, no error messages available

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
 
A

Alex

Figured it out. I was converting the date to a string when the dataset
was created....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top