Showing posts with label showpost. Show all posts
Showing posts with label showpost. Show all posts

Tuesday, March 20, 2012

Conditionally adding a column to my custom component (part 2)

A month or so ago I instigated this thread- http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=243117&SiteID=1 which talked about how to conditionally add a column to my component depending on the value of a custom property. If the custom property is TRUE then the column should appear in the output (and vice versa).

Bob Bojanic said I should use the SetComponentProperty() method to do this and that is working pretty well. However, it bothers me that SetComponentProperty() could be called, the column will then be added, and then the package developer could press 'Cancel'. In this instance the value of my custom property would be inconsistent with the presence of the extra column.

How do you get around that?

Thanks

Jamie

This is what component views are for. Call the GetComponentView method to create a view of the component. Then make all your changes to the component. If the user selects OK then call commit on the view. If the user selects cancel then call Cancel on the view. The view keeps track of all changes and commit saves them to the component and cancel discards all the changes.

Thanks,

Matt

|||

To get OK/Cancel functionaility in a component UI, for free, make sure you make all changes through the CManagedComponentWrapper instance of your component, not the component direct. I go on about this in the book, download the samples to see an example.

metaData is IDTSComponentMetaData90 normally passed on the form Ctor or your own setup method , comming from the UI class. Then call "CManagedComponentWrapper wrapper = metaData.Instantiate();" to get the wrapper.

Update - Matt are you sure about GetComponentView, was that not dropped or at least you no longer need to do it, sometime after beta 2 I think. The bool result from IDtsComponentUI.Edit is now sufficient to commit or rollback the changes made through the wrapper.

|||

Darren,

Yes, I am sure but the caveat here is that I always think in native code and everyone else thinks in managed code. For native code you need to use views. For managed code it does the views for you without your knowledge (please disregard the man behind the screen ).

Thanks,

Matt

sqlsql

Sunday, February 19, 2012

Concurrent Insert and Update Commands

Hi there,

I've had a look at this thread - http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=104399&SiteID=1 - but it's a bit old so I thought I'd try to clarify a couple of things.

I have a data flow which inserts or updates a table in a SQL 2000 database.

The insert is done via an OLE DB destination and the update is done via an OLE DB Command.

As stated in the previous thread, when these commands run concurrently issues arise with blocking etc.

The only way I've managed to get around it is by setting the access mode of the insert to OpenRowset.

So 2 questions:

1) Does anyone know how this problem occurrs and what the best way to get around it is?

2) Are there issues around NOT using the fast load options - I've read stuff about the double-byte character set etc but I admit I don't quite understand it.

Thanks.

I personally prefer to push my data to be updated into a raw file and then do the update in a seperate data-flow.

-Jamie

|||

Some points that might help:

Using Fast load defaults to having table lock on. You can turn table lock off (and keep Fast load.)