PC Review


Reply
Thread Tools Rate Thread

Date fields not upating, no error messages available

 
 
Alex
Guest
Posts: n/a
 
      28th Apr 2007
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

 
Reply With Quote
 
 
 
 
Alex
Guest
Posts: n/a
 
      28th Apr 2007
Figured it out. I was converting the date to a string when the dataset
was created....


 
Reply With Quote
 
sloan
Guest
Posts: n/a
 
      30th Apr 2007

catch (Exception e)
{
return 1 + e.Message;
}
return "0";

As others have shown me:
http://blogs.msdn.com/kcwalina/archi...16/396787.aspx








"Alex" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
windows defender not upating error 0xc80003f9 =?Utf-8?B?ZGFiMTgzNTE=?= Spyware Discussion 5 27th May 2007 05:19 AM
Error while Upating records Stephen Microsoft Access Queries 1 23rd Nov 2004 04:37 PM
Error while Upating Record Stephen Microsoft ASP .NET 3 22nd Nov 2004 11:50 PM
Re: How to export e-mail messages with date fields? Alexander Gorlach Microsoft Outlook Discussion 0 3rd Sep 2004 06:38 PM
RE: How to export e-mail messages with date fields? Venkat Srinivasan.R [ MSFT ] Microsoft Outlook Discussion 0 3rd Sep 2004 03:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:19 AM.