yes!!!!!!11
it worked like a charm.
thanks a zillion
(E-Mail Removed) (David Sceppa) wrote in message news:<(E-Mail Removed)>...
> It looks like you're trying to use the DataAdapter and
> DataTable to synchronize your databases. ADO.NET doesn't
> inherently support this functionality. However, with a little
> understand of how DataAdapter.Update works, you should be able to
> handle the scenario you described.
>
> When you call DataAdapter.Update, it looks checks each row's
> RowState and executes the corresponding update command
> (InsertCommand/UpdateCommand/DeleteCommand) to submit that row's
> pending change. The DataAdapter doesn't understand that the
> SelectCommand and InsertCommand pointed at different databases,
> or know that you wanted to submit all rows as inserts against the
> InsertCommand's Connection. It simply sees that all of the rows
> have a RowState of Unchanged and assumes there are no changes to
> submit.
>
> If prior to calling DataAdapter.Fill, you set
> DataAdapter.AcceptChangesDuringFill to False, the rows you create
> by calling DataAdapter.Fill will have a RowState of Added. The
> subsequent call to DataAdapter.Update will force the DataAdapter
> to execute the InsertCommand for each row.
>
> Things get more complex if the "target" database already
> contains rows that you retrieved from the "source" database. If
> that's a scenario you need to handle, and you simply want to
> overwrite such rows in the "target" database, you could set your
> InsertCommand to a query like the following:
>
> IF NOT EXISTS(SELECT ID FROM MyTable WHERE ID = @ID)
> BEGIN
> -- Insert Scenario
> INSERT INTO MyTable (...) VALUES (...)
> END
> ELSE
> BEGIN
> -- Update Scenario
> UPDATE MyTable SET ... WHERE ...
> END
>
> Of course, placing this logic in a stored procedure and
> calling the stored procedure from the InsertCommand would be an
> even better idea.
>
> I hope this information proves helpful.
>
> David Sceppa
> Microsoft
> This posting is provided "AS IS" with no warranties,
> and confers no rights. You assume all risk for your use.
> © 2003 Microsoft Corporation. All rights reserved.