Re: SqlDataAdapter Update Method won't work
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 12:24:49 -0400
Neal,
Are you trying to update in the event handler for a UI component? If
so, then try and wrap the code in a try/catch block. Exceptions that are
thrown in these event handlers are swallowed by the framework.
Also, check to make sure that the rows don't have a state of "unchanged"
associated with them.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Neal Whitney" <whitney_neal@xxxxxxxxxxx> wrote in message
news:eR1iuXMfFHA.3960@xxxxxxxxxxxxxxxxxxxxxxx
> Hi Nicholas, Thanks for the reply.
>
> I gave it a shot, no luck.
>
> Thanks for the advice though, I'll make sure and have this set to "true"
> in
> the future..
>
> I'll keep trying.. It's just seems weird that it wouldn't throw some kind
> of
> exception...
>
> "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote
> in
> message news:Oy7AfJMfFHA.2840@xxxxxxxxxxxxxxxxxxxxxxx
>> certolnut,
>>
>> I think you should change the second parameter to true, to preserve
> the
>> changes in the dataset. I believe that when you pass false, it will
>> cause
>> an AcceptChanges call to be made, which sets the state of all the rows to
>> Unchanged, which will not cause any updates to be made when passed
>> through
> a
>> data adapter.
>>
>> Hope this helps.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>>
>> "certolnut" <certolnut@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:14D5E90D-6E2A-4149-8F06-5D5B5BD10EC7@xxxxxxxxxxxxxxxx
>> > HI all
>> >
>> > New to C#
>> >
>> > I'm merging datasets. The source dataset is an excel file and the
>> > target
>> > dataset is in SqlServer.
>> >
>> >
> salesTracingCommisionNDCdataset1.Merge(ndcExcel,false,MissingSchemaAction.Er
> ror)
>> >
>> >
>> > The merge works fine. It will populate a datagrid after the merge is
>> > complete. However, when I issue the command to update the database,
>> > nothing
>> > happens. No errors, no exceptions. nothing.
>> >
>> > sqlDataAdapter2.Update(salesTracingCommisionNDCdataset1);
>> >
>> > I've checked the schemas, data typing, and I've ensured that the
> database
>> > has a primary Key. I've also ensured that I have proper permissions on
> the
>> > database
>> >
>> > Also. I let the Wizard generate the Update Command code.
>> >
>> > UPDATE SalesTracingCommissionNDCtable
>> > SET ItemNumber = @ItemNumber, Qty = @Qty, InvoiceDate =
>> > @InvoiceDate, BranchNo = @BranchNo
>> > WHERE (BranchNo = @Original_BranchNo) AND (InvoiceDate =
>> > @Original_InvoiceDate) AND (ItemNumber = @Original_ItemNumber) AND
>> > (Qty = @Original_Qty OR
>> > @Original_Qty IS NULL AND Qty IS NULL);
>> > SELECT ItemNumber, Qty, InvoiceDate,
> BranchNo
>> > FROM SalesTracingCommissionNDCtable
>> > WHERE (BranchNo = @BranchNo) AND
>> > (InvoiceDate
>> > = @InvoiceDate) AND (ItemNumber = @ItemNumber)
>> >
>> > Any advice on debugging?? Any help is appreciated
>>
>>
>
>
.
- Follow-Ups:
- Re: SqlDataAdapter Update Method won't work
- From: certolnut
- Re: SqlDataAdapter Update Method won't work
- References:
- SqlDataAdapter Update Method won't work
- From: certolnut
- Re: SqlDataAdapter Update Method won't work
- From: Nicholas Paldino [.NET/C# MVP]
- Re: SqlDataAdapter Update Method won't work
- From: Neal Whitney
- SqlDataAdapter Update Method won't work
- Prev by Date: Memory question
- Next by Date: Re: database storing > as it's html equivalent
- Previous by thread: Re: SqlDataAdapter Update Method won't work
- Next by thread: Re: SqlDataAdapter Update Method won't work
- Index(es):
Relevant Pages
|