Saturday, February 25, 2012

Custom Data Flow Components, DllImport, and third party dlls

I've been having an issue with the integration of a third-party DLL into a custom data flow component.

The company sent me a C# project that generates a simple console application. The project includes a class that calls their DLL with DllImport. The console application runs fine.

I created a stand-alone class using the C# class they sent to expose the methods of their DLL. In my custom component, I'm referencing this class to pass data to and from their DLL.

The first method from that stand-alone class that my component encounters simply gets their installation path from the registry and does not use DllImport. That path retrieval works fine. The next method calls a function that is declared with DllImport. Each time the call fails with "System.DllNotFoundException = {"Unable to load DLL AMZip.dll': Exception from HRESULT: 0xE06D7363"}".

I've copied this DLL to countless locations (e.g., the PipelineComponents directory, the project/solution bin directory) and included these paths in all manner of path variables.

What am I missing here? Their DLL is not strong named (does this matter since I'm using DllImport?), my stand-alone class is, and of course, the custom component itself is. I appreciate the help.

No bites, eh? OK, is there a standard directory for C++ dlls used in custom components?|||I think the question on everyone's mind is, what does this have to do with SSIS?|||Strictly speaking, your question might be better served in a C# forum or something. While we do custom development here, this isn't a programming forum.|||

Phil Brammer wrote:

I think the question on everyone's mind is, what does this have to do with SSIS?

Thanks for giving me the opportunity to explain why I posted this question in the SSIS forum!

Like I said, the class in my sample console application hums like a sewing machine. When I try to integrate it into an SSIS component it fails by an error for which I can find no explanation and the finest .NET programmer I know can find no explanation, having not dealt much with SSIS internals. There aren't a whole lot of people on Earth who program SSIS components, but one place they can be sure to be found is on this forum.

I guess the upshot is, I'm hoping to get a suggested nugget from someone who may have been down this road before, as opposed to a cocksure question.

|||If your application is built on the .net 2.0 framework, then this shouldn't be that hard. The 1.1 framework won't work in SSIS, I believe.

Getting your DLLs registered in the GAC might also help.|||

The third-party component in question is a C DLL. It has dependencies to msvcm80.dll, msvcp80.dll, msvcr80.dll, and Microsoft.VC80.CRT.manifest. I have a wrapper class for the DLL with DllIImport statements that makes its functions available for .NET.

The question is... does SSIS look for non-.NET dependencies in the system path? They are obviously not in the GAC since they're not .NET.

I am getting an error that leads me to believe the dependencies are not found; however, they are in one of the directories in the system path. What else can I do to get SSIS to find them?

|||

I would expect SSIS to behave much like any other program. Really the SSIS package will be hosted, but I would expect system32 to be a good location. Similarly your dependencies for the C++ DLL would need to be there. You could look at the SSIS install bin folder, not the project, but is a bit unreliable as may not always use a MS host that is in that bin folder. Getting system32 to work I think would be better in the same way that we say always put .Net dependencies in the GAC to ensure the runtime can find what it needs.

So if you try or have tried system32 and it still fails, what is missing? Use Filemon to look for file not found or access denied events and see where it is really looking. http://www.microsoft.com/technet/sysinternals/default.mspx

|||Are you using Vista? Ever since I brought my applications into Vista, I get that error when I try to link any DLL other than windows API. The same applications worked fine on XP. I copied the file all over the place and used the full path when linking and it still says that. I get this problem with all languages, not just C#.|||

Solution -1

1.Copy DLLS to your application\ bin folder(Virtual Dir)

2. Then do the following in code.........before you do a pInvoke

StringBuilder LocalFolder = new StringBuilder(AppDomain.CurrentDomain.BaseDirectory);

LocalFolder.Append("bin");

Directory.SetCurrentDirectory(LocalFolder.ToString());

3. Then give security permission "modify" for the "bin" folder for the following

a. ASP.Net Machine accounts..

b. Network services

c. youself!!!!!!!!!!(ur login)..

4. Try ur luck..

This happens when u are in a comapany with strict access

DISCLAIMER...

I tested it out..works for me..may not work for u..I am not responsible for the damage caused due to this post

Soultion -2

The Administrator need to grant you access to the ASP.NET temporary directory (somewhere in the WINNT ).

DISCLAIMER...

I didn't test it out...got a clue from net..which lead to my solution..I am posting it bcos it may help other poor souls who has this problem..I am not responsible for the damage caused due to this post.

Pls exuce my weak knowledge of .net tehnologies.. I am a C++ /Windows programmer forced to do .Net deployment

Custom Data Flow Components, DllImport, and third party dlls

I've been having an issue with the integration of a third-party DLL into a custom data flow component.

The company sent me a C# project that generates a simple console application. The project includes a class that calls their DLL with DllImport. The console application runs fine.

I created a stand-alone class using the C# class they sent to expose the methods of their DLL. In my custom component, I'm referencing this class to pass data to and from their DLL.

The first method from that stand-alone class that my component encounters simply gets their installation path from the registry and does not use DllImport. That path retrieval works fine. The next method calls a function that is declared with DllImport. Each time the call fails with "System.DllNotFoundException = {"Unable to load DLL AMZip.dll': Exception from HRESULT: 0xE06D7363"}".

I've copied this DLL to countless locations (e.g., the PipelineComponents directory, the project/solution bin directory) and included these paths in all manner of path variables.

What am I missing here? Their DLL is not strong named (does this matter since I'm using DllImport?), my stand-alone class is, and of course, the custom component itself is. I appreciate the help.

No bites, eh? OK, is there a standard directory for C++ dlls used in custom components?|||I think the question on everyone's mind is, what does this have to do with SSIS?|||Strictly speaking, your question might be better served in a C# forum or something. While we do custom development here, this isn't a programming forum.|||

Phil Brammer wrote:

I think the question on everyone's mind is, what does this have to do with SSIS?

Thanks for giving me the opportunity to explain why I posted this question in the SSIS forum!

Like I said, the class in my sample console application hums like a sewing machine. When I try to integrate it into an SSIS component it fails by an error for which I can find no explanation and the finest .NET programmer I know can find no explanation, having not dealt much with SSIS internals. There aren't a whole lot of people on Earth who program SSIS components, but one place they can be sure to be found is on this forum.

I guess the upshot is, I'm hoping to get a suggested nugget from someone who may have been down this road before, as opposed to a cocksure question.

|||If your application is built on the .net 2.0 framework, then this shouldn't be that hard. The 1.1 framework won't work in SSIS, I believe.

Getting your DLLs registered in the GAC might also help.|||

The third-party component in question is a C DLL. It has dependencies to msvcm80.dll, msvcp80.dll, msvcr80.dll, and Microsoft.VC80.CRT.manifest. I have a wrapper class for the DLL with DllIImport statements that makes its functions available for .NET.

The question is... does SSIS look for non-.NET dependencies in the system path? They are obviously not in the GAC since they're not .NET.

I am getting an error that leads me to believe the dependencies are not found; however, they are in one of the directories in the system path. What else can I do to get SSIS to find them?

|||

I would expect SSIS to behave much like any other program. Really the SSIS package will be hosted, but I would expect system32 to be a good location. Similarly your dependencies for the C++ DLL would need to be there. You could look at the SSIS install bin folder, not the project, but is a bit unreliable as may not always use a MS host that is in that bin folder. Getting system32 to work I think would be better in the same way that we say always put .Net dependencies in the GAC to ensure the runtime can find what it needs.

So if you try or have tried system32 and it still fails, what is missing? Use Filemon to look for file not found or access denied events and see where it is really looking. http://www.microsoft.com/technet/sysinternals/default.mspx

|||Are you using Vista? Ever since I brought my applications into Vista, I get that error when I try to link any DLL other than windows API. The same applications worked fine on XP. I copied the file all over the place and used the full path when linking and it still says that. I get this problem with all languages, not just C#.|||

Solution -1

1.Copy DLLS to your application\ bin folder(Virtual Dir)

2. Then do the following in code.........before you do a pInvoke

StringBuilder LocalFolder = new StringBuilder(AppDomain.CurrentDomain.BaseDirectory);

LocalFolder.Append("bin");

Directory.SetCurrentDirectory(LocalFolder.ToString());

3. Then give security permission "modify" for the "bin" folder for the following

a. ASP.Net Machine accounts..

b. Network services

c. youself!!!!!!!!!!(ur login)..

4. Try ur luck..

This happens when u are in a comapany with strict access

DISCLAIMER...

I tested it out..works for me..may not work for u..I am not responsible for the damage caused due to this post

Soultion -2

The Administrator need to grant you access to the ASP.NET temporary directory (somewhere in the WINNT ).

DISCLAIMER...

I didn't test it out...got a clue from net..which lead to my solution..I am posting it bcos it may help other poor souls who has this problem..I am not responsible for the damage caused due to this post.

Pls exuce my weak knowledge of .net tehnologies.. I am a C++ /Windows programmer forced to do .Net deployment

Custom Data Flow Components, DllImport, and third party dlls

I've been having an issue with the integration of a third-party DLL into a custom data flow component.

The company sent me a C# project that generates a simple console application. The project includes a class that calls their DLL with DllImport. The console application runs fine.

I created a stand-alone class using the C# class they sent to expose the methods of their DLL. In my custom component, I'm referencing this class to pass data to and from their DLL.

The first method from that stand-alone class that my component encounters simply gets their installation path from the registry and does not use DllImport. That path retrieval works fine. The next method calls a function that is declared with DllImport. Each time the call fails with "System.DllNotFoundException = {"Unable to load DLL AMZip.dll': Exception from HRESULT: 0xE06D7363"}".

I've copied this DLL to countless locations (e.g., the PipelineComponents directory, the project/solution bin directory) and included these paths in all manner of path variables.

What am I missing here? Their DLL is not strong named (does this matter since I'm using DllImport?), my stand-alone class is, and of course, the custom component itself is. I appreciate the help.

No bites, eh? OK, is there a standard directory for C++ dlls used in custom components?|||I think the question on everyone's mind is, what does this have to do with SSIS?|||Strictly speaking, your question might be better served in a C# forum or something. While we do custom development here, this isn't a programming forum.|||

Phil Brammer wrote:

I think the question on everyone's mind is, what does this have to do with SSIS?

Thanks for giving me the opportunity to explain why I posted this question in the SSIS forum!

Like I said, the class in my sample console application hums like a sewing machine. When I try to integrate it into an SSIS component it fails by an error for which I can find no explanation and the finest .NET programmer I know can find no explanation, having not dealt much with SSIS internals. There aren't a whole lot of people on Earth who program SSIS components, but one place they can be sure to be found is on this forum.

I guess the upshot is, I'm hoping to get a suggested nugget from someone who may have been down this road before, as opposed to a cocksure question.

|||If your application is built on the .net 2.0 framework, then this shouldn't be that hard. The 1.1 framework won't work in SSIS, I believe.

Getting your DLLs registered in the GAC might also help.|||

The third-party component in question is a C DLL. It has dependencies to msvcm80.dll, msvcp80.dll, msvcr80.dll, and Microsoft.VC80.CRT.manifest. I have a wrapper class for the DLL with DllIImport statements that makes its functions available for .NET.

The question is... does SSIS look for non-.NET dependencies in the system path? They are obviously not in the GAC since they're not .NET.

I am getting an error that leads me to believe the dependencies are not found; however, they are in one of the directories in the system path. What else can I do to get SSIS to find them?

|||

I would expect SSIS to behave much like any other program. Really the SSIS package will be hosted, but I would expect system32 to be a good location. Similarly your dependencies for the C++ DLL would need to be there. You could look at the SSIS install bin folder, not the project, but is a bit unreliable as may not always use a MS host that is in that bin folder. Getting system32 to work I think would be better in the same way that we say always put .Net dependencies in the GAC to ensure the runtime can find what it needs.

So if you try or have tried system32 and it still fails, what is missing? Use Filemon to look for file not found or access denied events and see where it is really looking. http://www.microsoft.com/technet/sysinternals/default.mspx

|||Are you using Vista? Ever since I brought my applications into Vista, I get that error when I try to link any DLL other than windows API. The same applications worked fine on XP. I copied the file all over the place and used the full path when linking and it still says that. I get this problem with all languages, not just C#.|||

Solution -1

1.Copy DLLS to your application\ bin folder(Virtual Dir)

2. Then do the following in code.........before you do a pInvoke

StringBuilder LocalFolder = new StringBuilder(AppDomain.CurrentDomain.BaseDirectory);

LocalFolder.Append("bin");

Directory.SetCurrentDirectory(LocalFolder.ToString());

3. Then give security permission "modify" for the "bin" folder for the following

a. ASP.Net Machine accounts..

b. Network services

c. youself!!!!!!!!!!(ur login)..

4. Try ur luck..

This happens when u are in a comapany with strict access

DISCLAIMER...

I tested it out..works for me..may not work for u..I am not responsible for the damage caused due to this post

Soultion -2

The Administrator need to grant you access to the ASP.NET temporary directory (somewhere in the WINNT ).

DISCLAIMER...

I didn't test it out...got a clue from net..which lead to my solution..I am posting it bcos it may help other poor souls who has this problem..I am not responsible for the damage caused due to this post.

Pls exuce my weak knowledge of .net tehnologies.. I am a C++ /Windows programmer forced to do .Net deployment

Custom Data Flow Component Column Mapping Question

Hi,

I'm having my first go at developing a destination adapter which will send data to an update Web Service.

I've got some rather big gaps in my understanding. I've been following the various samples I've found on the net and have validated my mapping and picked up all the available column names and datatypes which are appearing in the Input and Output Properties tab of the Advanced Editor but I only have a tab for "Input Columns" and not "Column Mappings".

Which method defines the availble columns for the user to map?

Let me know if I haven't given enough information.

cheers

sorry - I had searched already but somehow missed this post which answered my question: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=239126&SiteID=1

I was having the same confusion about input and output, thinking that because i was creating a *destination* adapter, that I should be creating outputs not inputs [if that makes sense].

Custom Data Flow

To all the SSIS gurus,

I have a situation where I have multiple source tables, I need to populate the destination tables that have the same schema as the source ones. I dont want to do the repetitive task of creating a Dataflow for each source-destination load.

I want to create one custom dataflow component and loop through all my source tables and provide destination tables dynamically.

Is there a way to do that? Any custom data flow component out there?

Your ideas are greatly appreciated.

Regards,

ssiscoder wrote:

To all the SSIS gurus,

I have a situation where I have multiple source tables, I need to populate the destination tables that have the same schema as the source ones. I dont want to do the repetitive task of creating a Dataflow for each source-destination load.

I want to create one custom dataflow component and loop through all my source tables and provide destination tables dynamically.

Is there a way to do that? Any custom data flow component out there?

Your ideas are greatly appreciated.

Regards,

No you can't do this currently. Well, not with the out-of0the-box components anyway.

What you CAN do is build a package programatically in dotnet using the SSIS API. That dotnet code can be called from any place that can execute dotnet code. One of those places happens to be a SSIS package.

HTH.

-Jamie

|||

Thanks for the info Jamie!

Can you please post some articles here of how to go about doing the data flow part programitically?

Regards,

|||

ssiscoder wrote:

Thanks for the info Jamie!

Can you please post some articles here of how to go about doing the data flow part programitically?

Regards,

I can do better than that. here's a sample:

http://msdn2.microsoft.com/en-us/library/ms161541.aspx

-Jamie

|||

This might help as well: http://msdn2.microsoft.com/en-us/library/ms345167.aspx

-Jamie

Custom Data Extensions Previewing Report

I have created a custom Data extension that returns a dataset through
a datareader. I am attempting to create a report using this extension
as the datasource and am receiving an error when trying to view the
report in Preview. The error is saying it can not find my extension
Datasource.
Any ideas on how to fix this? Or any reasons why this is occuring?
Thanks,
JerryJerry wrote:
> report in Preview. The error is saying it can not find my extension
> Datasource.
Check out this[0] article, especially about 3/4 of the way down under
"deploying the extension". I'm betting your missing a config file
modification.
[0]
http://msdn.microsoft.com/sql/default.aspx?pull=/library/en-us/dnsql2k/html/rsdsetex3.asp
--
Thanks.
Donovan R. Smith
Software Test Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Custom Data Extensions and Custom Code: do they require any special settings for internet?

I have configured the config files so that my custom code and data extension
work fine internally. I am having problems getting them to work over the
internet.
Are there any special considerations for this?
ThanksWhat kind of problems?
What do you mean by "work over the internet"?
--
Alex Mineev
Software Design Engineer. Report expressions; Code Access Security; Xml;
SQE.
This posting is provided "AS IS" with no warranties, and confers no rights
"Kevin" <k@.r.com> wrote in message
news:uCmWs0kCFHA.2632@.TK2MSFTNGP09.phx.gbl...
> I have configured the config files so that my custom code and data
extension
> work fine internally. I am having problems getting them to work over the
> internet.
> Are there any special considerations for this?
> Thanks
>|||I have solved the issue. Code Access had to be set for the custom dll.
Thanks
"Alexandre Mineev [MSFT]" <almineev@.microsoft.com> wrote in message
news:eXrtP9tDFHA.392@.TK2MSFTNGP14.phx.gbl...
> What kind of problems?
> What do you mean by "work over the internet"?
> --
> Alex Mineev
> Software Design Engineer. Report expressions; Code Access Security; Xml;
> SQE.
> This posting is provided "AS IS" with no warranties, and confers no rights
> "Kevin" <k@.r.com> wrote in message
> news:uCmWs0kCFHA.2632@.TK2MSFTNGP09.phx.gbl...
>> I have configured the config files so that my custom code and data
> extension
>> work fine internally. I am having problems getting them to work over the
>> internet.
>> Are there any special considerations for this?
>> Thanks
>>
>

Custom Data Extensions - Multiple Datasets.

Hi,
I know your probably going to tell me that this is not possible, but I am a
whisker away from getting it to work.. So there must be a way.
I have managed to extend reporting services with my own Data Processing
Extension (DPE).
With the combination of a dynamic web service proxy generator and the RDL
params provided by the Report Designer wizard i.e., Connectionstring & Query
I am able to call a web service dynamically and return a serialized dataset
from a web method.
This is then used by reporting services report designer wizard to provide a
list of fields in the dataset which are then used to layout the report.
Connectionstring = WebService URL e.g. http://local/mywebservice.asmx
Query = WebMethod e.g. GetDataset
It works great with a single dataset.
Now,
All this is done at run-time, and I know at design time it is possible to
add multiple datasets which gives you the nifty drop down list of datasets in
the fields window.
However, I have a dataset which contains multiple datasets and I wish to do
the same thing that reporting services does at design-time but at run-time.
Structure:
========== DataSet 1
DataSet A
DataSet B
DataSet C
Just for further information, I am extending the IDataReader Interface and
passing back the dataset through the Systems.Collections.IEnumerator
Interface.we are doing the same thing in my company please contact me at
andrescampos99@.hotmail.com with the source code and we will glad to assist you
"eskimo" wrote:
> Hi,
> I know your probably going to tell me that this is not possible, but I am a
> whisker away from getting it to work.. So there must be a way.
> I have managed to extend reporting services with my own Data Processing
> Extension (DPE).
> With the combination of a dynamic web service proxy generator and the RDL
> params provided by the Report Designer wizard i.e., Connectionstring & Query
> I am able to call a web service dynamically and return a serialized dataset
> from a web method.
> This is then used by reporting services report designer wizard to provide a
> list of fields in the dataset which are then used to layout the report.
> Connectionstring = WebService URL e.g. http://local/mywebservice.asmx
> Query = WebMethod e.g. GetDataset
> It works great with a single dataset.
> Now,
> All this is done at run-time, and I know at design time it is possible to
> add multiple datasets which gives you the nifty drop down list of datasets in
> the fields window.
> However, I have a dataset which contains multiple datasets and I wish to do
> the same thing that reporting services does at design-time but at run-time.
> Structure:
> ==========> DataSet 1
> DataSet A
> DataSet B
> DataSet C
> Just for further information, I am extending the IDataReader Interface and
> passing back the dataset through the Systems.Collections.IEnumerator
> Interface.

Custom Data Extension Trace

Hi,
could anybody help to figure out what is the correct (recommended) way to
write trace messages for custom data processing extension? I have written
such an extension and I would like to enable trace for it to be able to see
how it performs through the time.
I tried to write trace messages using RSTrace, but I got permission
exception and I guess it means that reporting services prevents to use this
class in different assembly than ReportingServices.Diagnostics.dll.
Then I tried to add trace listener (TextWriterTraceListener) to
<system.diagnostics> section of ReportingServicesService.exe.config file.
Doing so I got an IOException that the target file is used by different
process and report server refuse to start at all.
Is it possible to somhow use System.Diagnostics.Trace in custom data
extension?
Thanks,
MarekI'm not sure, but I'm just guessing you'll need to add some lines to the
rssrvpolicy.config file located here:
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer
Have you done this?
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Marek Zoth" <MarekZoth@.discussions.microsoft.com> wrote in message
news:EE4A6E80-6FDB-4900-8835-5F8117285E6F@.microsoft.com...
> Hi,
> could anybody help to figure out what is the correct (recommended) way to
> write trace messages for custom data processing extension? I have written
> such an extension and I would like to enable trace for it to be able to
> see
> how it performs through the time.
> I tried to write trace messages using RSTrace, but I got permission
> exception and I guess it means that reporting services prevents to use
> this
> class in different assembly than ReportingServices.Diagnostics.dll.
> Then I tried to add trace listener (TextWriterTraceListener) to
> <system.diagnostics> section of ReportingServicesService.exe.config file.
> Doing so I got an IOException that the target file is used by different
> process and report server refuse to start at all.
> Is it possible to somhow use System.Diagnostics.Trace in custom data
> extension?
> Thanks,
> Marek|||Thanks Jeff,
I tried, my extension runs in FullTrust mode and I tried to increase
permissions also for ReportingServices.Diagnostics.dll but no success. The
exception I got is:
--> System.Security.SecurityException: Request for the permission of type
System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at DataExtension.TACommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.ReportingServices.ReportProcessing.a0.v()
The state of the failed permission was:
<IPermission
class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000100272736AD6E5F9586BAC2D531EABC3ACC666C2F8EC879FA94F8F7B0327D2FF2ED523448F83C3D5C5DD2DFC7BC99C5286B2C125117BF5CBE242B9D41750732B2BDFFE649C6EFB8E5526D526FDD130095ECDB7BF210809C6CDAD8824FAA9AC0310AC3CBA2AA0523567B2DFA7FE250B30FACBD62D4EC99B94AC47C7D3B28F1F6E4C8"/>
I am not sure what it exactly means but looking to MSDN it seeem to me RS
prevents calling RSTrace. Or am I wrong?
Any idea how to write traces in custom data extensions is appreciated.
Thanks,
M.
"Jeff A. Stucker" wrote:
> I'm not sure, but I'm just guessing you'll need to add some lines to the
> rssrvpolicy.config file located here:
> C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer
> Have you done this?
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "Marek Zoth" <MarekZoth@.discussions.microsoft.com> wrote in message
> news:EE4A6E80-6FDB-4900-8835-5F8117285E6F@.microsoft.com...
> > Hi,
> >
> > could anybody help to figure out what is the correct (recommended) way to
> > write trace messages for custom data processing extension? I have written
> > such an extension and I would like to enable trace for it to be able to
> > see
> > how it performs through the time.
> >
> > I tried to write trace messages using RSTrace, but I got permission
> > exception and I guess it means that reporting services prevents to use
> > this
> > class in different assembly than ReportingServices.Diagnostics.dll.
> >
> > Then I tried to add trace listener (TextWriterTraceListener) to
> > <system.diagnostics> section of ReportingServicesService.exe.config file.
> > Doing so I got an IOException that the target file is used by different
> > process and report server refuse to start at all.
> >
> > Is it possible to somhow use System.Diagnostics.Trace in custom data
> > extension?
> >
> > Thanks,
> >
> > Marek
>
>

Custom Data Extension to SQL Server

Where I work we have custom code to retrieve the connection string. Theprogrammer provides a role and a mode and a connection object isretured. I need similar functionality from Reporting Services and I'mnot sure where to start. I was thinking of passing the role and mode inas username and password under credentials and being able to use thisas my connection to get data for reports. Any help in solving thisproblem would be greatly appreciated.

SQL Server Reporting services is part of SQL Server so you can create roles either with stored procedure or under permissions in Enterprise manager. Hope this helps.

Kind regards,

Gift Peddie

|||Sorry but you did not understand my post. Please read before replying.As I said we have custom code that we pass a role and mode to that willgive us the CONNECTIONSTRING.
Ryan
|||

Sorry maybe the link below could help.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secmod/html/secmod12.asp

Kind regards,

Gift Peddie

|||I have figured it out and that link doesn't relate to the problem.
I figured out how to do a custom data extension but I am getting astack overflow exception when I try using the extension. I am alsogetting a SecurityPermission exception when I try calling a functionthat uses interop code. So anyone with any ideas to either of theseproblems would be appreciated.
Ryan

Custom Data Extension problems

Hi all,
I'm trying to develop a custom data extension for a proprietary database we
use, and I'm running into problems. I've built a test harness for it and it
works fine; however when I try to use it with RS I get the following error
just after having entered my query and pressed Next in the New Report wizard:
"An error occurred while the query design method was being saved. Object
reference not set to an instance of an object"
When I step through my code, I can see that everything goes well until the
designer tries to call the Parameters property on the Command object. Because
my database doesn't support parameters I'm returning null here, something
I've seen in several code examples. As soon as I've exited the property I get
the error, with the debugger saying it originates from
Microsoft.ReportDesigner.Design.Query.HasParameters.
Other background information (in no particular order):
- Before I get to the Parameters property, I see that the GetName and
GetFieldType properties on my DataReader are called the same number of times
as there are columns in my resultset, and then the Dispose method is called
on the DataReader.
- My queries are in XML, and here's the sample I'm using for testing:
<DVAutoXMLFetch Database="C:\Program Files\IMS Health\DATA\DBPINT01.PRM">
<TimePeriods Count="4">
<TimePeriod>QTR/3/02</TimePeriod>
</TimePeriods>
<Variables Count="3">
<Variable>UN</Variable>
</Variables>
<Dimensions Count="16">
<Dimension Name="CTY" IsGroup="False" BaseDim="">
<Member>AUSTRIA</Member>
</Dimension>
</Dimensions>
<FetchDefinition>
<NumberPrecision ValColNumPrec="1000" ValColRndPrec="1" CalcColRndPrec="3"
/>
<AcrossMeasures Count="2">
<AcrossMeasure Index="1" DimName="TimePeriods" />
<AcrossMeasure Index="2" DimName="Variables" />
<Columns Count="1" Rank="0" CalcRank="0" />
</AcrossMeasures>
<DownMeasures Count="1">
<DownMeasure Index="1" DimName="CTY" />
</DownMeasures>
</FetchDefinition>
</DVAutoXMLFetch>
- I'm running RS SP1 on Windows 2000.
- I can post the source code if anyone wants...
Thanks in advance for any hints!
ChrisChris,
Don't return null. Instead, instantiate your ParameterCollection and return
it back although it will be emply.
--
Hope this helps.
----
Teo Lachev, MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
----
"Chris Webb" <OnlyForPostingToNewsgroups@.hotmail.com> wrote in message
news:7373D28A-BDDA-450B-B1DC-53605BF8C821@.microsoft.com...
> Hi all,
> I'm trying to develop a custom data extension for a proprietary database
we
> use, and I'm running into problems. I've built a test harness for it and
it
> works fine; however when I try to use it with RS I get the following error
> just after having entered my query and pressed Next in the New Report
wizard:
> "An error occurred while the query design method was being saved. Object
> reference not set to an instance of an object"
> When I step through my code, I can see that everything goes well until the
> designer tries to call the Parameters property on the Command object.
Because
> my database doesn't support parameters I'm returning null here, something
> I've seen in several code examples. As soon as I've exited the property I
get
> the error, with the debugger saying it originates from
> Microsoft.ReportDesigner.Design.Query.HasParameters.
> Other background information (in no particular order):
> - Before I get to the Parameters property, I see that the GetName and
> GetFieldType properties on my DataReader are called the same number of
times
> as there are columns in my resultset, and then the Dispose method is
called
> on the DataReader.
> - My queries are in XML, and here's the sample I'm using for testing:
> <DVAutoXMLFetch Database="C:\Program Files\IMS Health\DATA\DBPINT01.PRM">
> <TimePeriods Count="4">
> <TimePeriod>QTR/3/02</TimePeriod>
> </TimePeriods>
> <Variables Count="3">
> <Variable>UN</Variable>
> </Variables>
> <Dimensions Count="16">
> <Dimension Name="CTY" IsGroup="False" BaseDim="">
> <Member>AUSTRIA</Member>
> </Dimension>
> </Dimensions>
> <FetchDefinition>
> <NumberPrecision ValColNumPrec="1000" ValColRndPrec="1"
CalcColRndPrec="3"
> />
> <AcrossMeasures Count="2">
> <AcrossMeasure Index="1" DimName="TimePeriods" />
> <AcrossMeasure Index="2" DimName="Variables" />
> <Columns Count="1" Rank="0" CalcRank="0" />
> </AcrossMeasures>
> <DownMeasures Count="1">
> <DownMeasure Index="1" DimName="CTY" />
> </DownMeasures>
> </FetchDefinition>
> </DVAutoXMLFetch>
> - I'm running RS SP1 on Windows 2000.
> - I can post the source code if anyone wants...
> Thanks in advance for any hints!
> Chris
>|||Hi Teo,
Thanks, that solved that problem. I've seen several code examples which
returned null for Parameters, which presumably must have worked at some
point; has the behaviour changed since beta 1?
Anyway, I have a new problem now - the report wizard almost, but I get a COM
Interop exception when I click Finish. The error originates from
Microsoft.DataWarehouse.VsIntegration.Designer.Serialization.DataWarehouseContainerManager.CreateDocumentObjectDictionary.
Once again the error is raised from outside my code. Any more ideas?
Thanks again,
Chris
"Teo Lachev" wrote:
> Chris,
> Don't return null. Instead, instantiate your ParameterCollection and return
> it back although it will be emply.
> --
> Hope this helps.
> ----
> Teo Lachev, MCSD, MCT
> Author: "Microsoft Reporting Services in Action"
> Publisher website: http://www.manning.com/lachev
> Buy it from Amazon.com: http://shrinkster.com/eq
> Home page and blog: http://www.prologika.com/
> ----
> "Chris Webb" <OnlyForPostingToNewsgroups@.hotmail.com> wrote in message
> news:7373D28A-BDDA-450B-B1DC-53605BF8C821@.microsoft.com...
> > Hi all,
> >
> > I'm trying to develop a custom data extension for a proprietary database
> we
> > use, and I'm running into problems. I've built a test harness for it and
> it
> > works fine; however when I try to use it with RS I get the following error
> > just after having entered my query and pressed Next in the New Report
> wizard:
> > "An error occurred while the query design method was being saved. Object
> > reference not set to an instance of an object"
> >
> > When I step through my code, I can see that everything goes well until the
> > designer tries to call the Parameters property on the Command object.
> Because
> > my database doesn't support parameters I'm returning null here, something
> > I've seen in several code examples. As soon as I've exited the property I
> get
> > the error, with the debugger saying it originates from
> > Microsoft.ReportDesigner.Design.Query.HasParameters.
> >
> > Other background information (in no particular order):
> > - Before I get to the Parameters property, I see that the GetName and
> > GetFieldType properties on my DataReader are called the same number of
> times
> > as there are columns in my resultset, and then the Dispose method is
> called
> > on the DataReader.
> > - My queries are in XML, and here's the sample I'm using for testing:
> > <DVAutoXMLFetch Database="C:\Program Files\IMS Health\DATA\DBPINT01.PRM">
> > <TimePeriods Count="4">
> > <TimePeriod>QTR/3/02</TimePeriod>
> > </TimePeriods>
> > <Variables Count="3">
> > <Variable>UN</Variable>
> > </Variables>
> > <Dimensions Count="16">
> > <Dimension Name="CTY" IsGroup="False" BaseDim="">
> > <Member>AUSTRIA</Member>
> > </Dimension>
> > </Dimensions>
> > <FetchDefinition>
> > <NumberPrecision ValColNumPrec="1000" ValColRndPrec="1"
> CalcColRndPrec="3"
> > />
> > <AcrossMeasures Count="2">
> > <AcrossMeasure Index="1" DimName="TimePeriods" />
> > <AcrossMeasure Index="2" DimName="Variables" />
> > <Columns Count="1" Rank="0" CalcRank="0" />
> > </AcrossMeasures>
> > <DownMeasures Count="1">
> > <DownMeasure Index="1" DimName="CTY" />
> > </DownMeasures>
> > </FetchDefinition>
> > </DVAutoXMLFetch>
> > - I'm running RS SP1 on Windows 2000.
> > - I can post the source code if anyone wants...
> >
> > Thanks in advance for any hints!
> >
> > Chris
> >
>
>|||Chris,
Not from the top of my head. Could you put breakpoints in all public methods
and see after which call the exception is thrown. There must be something
quirky in the data extension itself.
--
Hope this helps.
----
Teo Lachev, MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
----
"Chris Webb" <OnlyForPostingToNewsgroups@.hotmail.com> wrote in message
news:987083A9-8CE5-4A99-A887-A32247FB8776@.microsoft.com...
> Hi Teo,
> Thanks, that solved that problem. I've seen several code examples which
> returned null for Parameters, which presumably must have worked at some
> point; has the behaviour changed since beta 1?
> Anyway, I have a new problem now - the report wizard almost, but I get a
COM
> Interop exception when I click Finish. The error originates from
>
Microsoft.DataWarehouse.VsIntegration.Designer.Serialization.DataWarehouseCo
ntainerManager.CreateDocumentObjectDictionary.
> Once again the error is raised from outside my code. Any more ideas?
> Thanks again,
> Chris
> "Teo Lachev" wrote:
> > Chris,
> >
> > Don't return null. Instead, instantiate your ParameterCollection and
return
> > it back although it will be emply.
> >
> > --
> > Hope this helps.
> >
> > ----
> > Teo Lachev, MCSD, MCT
> > Author: "Microsoft Reporting Services in Action"
> > Publisher website: http://www.manning.com/lachev
> > Buy it from Amazon.com: http://shrinkster.com/eq
> > Home page and blog: http://www.prologika.com/
> > ----
> >
> > "Chris Webb" <OnlyForPostingToNewsgroups@.hotmail.com> wrote in message
> > news:7373D28A-BDDA-450B-B1DC-53605BF8C821@.microsoft.com...
> > > Hi all,
> > >
> > > I'm trying to develop a custom data extension for a proprietary
database
> > we
> > > use, and I'm running into problems. I've built a test harness for it
and
> > it
> > > works fine; however when I try to use it with RS I get the following
error
> > > just after having entered my query and pressed Next in the New Report
> > wizard:
> > > "An error occurred while the query design method was being saved.
Object
> > > reference not set to an instance of an object"
> > >
> > > When I step through my code, I can see that everything goes well until
the
> > > designer tries to call the Parameters property on the Command object.
> > Because
> > > my database doesn't support parameters I'm returning null here,
something
> > > I've seen in several code examples. As soon as I've exited the
property I
> > get
> > > the error, with the debugger saying it originates from
> > > Microsoft.ReportDesigner.Design.Query.HasParameters.
> > >
> > > Other background information (in no particular order):
> > > - Before I get to the Parameters property, I see that the GetName and
> > > GetFieldType properties on my DataReader are called the same number of
> > times
> > > as there are columns in my resultset, and then the Dispose method is
> > called
> > > on the DataReader.
> > > - My queries are in XML, and here's the sample I'm using for testing:
> > > <DVAutoXMLFetch Database="C:\Program Files\IMS
Health\DATA\DBPINT01.PRM">
> > > <TimePeriods Count="4">
> > > <TimePeriod>QTR/3/02</TimePeriod>
> > > </TimePeriods>
> > > <Variables Count="3">
> > > <Variable>UN</Variable>
> > > </Variables>
> > > <Dimensions Count="16">
> > > <Dimension Name="CTY" IsGroup="False" BaseDim="">
> > > <Member>AUSTRIA</Member>
> > > </Dimension>
> > > </Dimensions>
> > > <FetchDefinition>
> > > <NumberPrecision ValColNumPrec="1000" ValColRndPrec="1"
> > CalcColRndPrec="3"
> > > />
> > > <AcrossMeasures Count="2">
> > > <AcrossMeasure Index="1" DimName="TimePeriods" />
> > > <AcrossMeasure Index="2" DimName="Variables" />
> > > <Columns Count="1" Rank="0" CalcRank="0" />
> > > </AcrossMeasures>
> > > <DownMeasures Count="1">
> > > <DownMeasure Index="1" DimName="CTY" />
> > > </DownMeasures>
> > > </FetchDefinition>
> > > </DVAutoXMLFetch>
> > > - I'm running RS SP1 on Windows 2000.
> > > - I can post the source code if anyone wants...
> > >
> > > Thanks in advance for any hints!
> > >
> > > Chris
> > >
> >
> >
> >|||Teo,
I did that and still had no luck - and then saw the bug by accident and
fixed it. Everything now seems to run fine, but it did make me wonder - I was
debugging the devenv.exe process, but when you run a report in preview
(rather than build it) does it spawn a new process? That might explain my
problems debugging it, no?
Thanks for all your help,
Chris
"Teo Lachev" wrote:
> Chris,
> Not from the top of my head. Could you put breakpoints in all public methods
> and see after which call the exception is thrown. There must be something
> quirky in the data extension itself.
> --
> Hope this helps.
> ----
> Teo Lachev, MCSD, MCT
> Author: "Microsoft Reporting Services in Action"
> Publisher website: http://www.manning.com/lachev
> Buy it from Amazon.com: http://shrinkster.com/eq
> Home page and blog: http://www.prologika.com/
> ----
> "Chris Webb" <OnlyForPostingToNewsgroups@.hotmail.com> wrote in message
> news:987083A9-8CE5-4A99-A887-A32247FB8776@.microsoft.com...
> > Hi Teo,
> >
> > Thanks, that solved that problem. I've seen several code examples which
> > returned null for Parameters, which presumably must have worked at some
> > point; has the behaviour changed since beta 1?
> >
> > Anyway, I have a new problem now - the report wizard almost, but I get a
> COM
> > Interop exception when I click Finish. The error originates from
> >
> Microsoft.DataWarehouse.VsIntegration.Designer.Serialization.DataWarehouseCo
> ntainerManager.CreateDocumentObjectDictionary.
> > Once again the error is raised from outside my code. Any more ideas?
> >
> > Thanks again,
> >
> > Chris
> >
> > "Teo Lachev" wrote:
> >
> > > Chris,
> > >
> > > Don't return null. Instead, instantiate your ParameterCollection and
> return
> > > it back although it will be emply.
> > >
> > > --
> > > Hope this helps.
> > >
> > > ----
> > > Teo Lachev, MCSD, MCT
> > > Author: "Microsoft Reporting Services in Action"
> > > Publisher website: http://www.manning.com/lachev
> > > Buy it from Amazon.com: http://shrinkster.com/eq
> > > Home page and blog: http://www.prologika.com/
> > > ----
> > >
> > > "Chris Webb" <OnlyForPostingToNewsgroups@.hotmail.com> wrote in message
> > > news:7373D28A-BDDA-450B-B1DC-53605BF8C821@.microsoft.com...
> > > > Hi all,
> > > >
> > > > I'm trying to develop a custom data extension for a proprietary
> database
> > > we
> > > > use, and I'm running into problems. I've built a test harness for it
> and
> > > it
> > > > works fine; however when I try to use it with RS I get the following
> error
> > > > just after having entered my query and pressed Next in the New Report
> > > wizard:
> > > > "An error occurred while the query design method was being saved.
> Object
> > > > reference not set to an instance of an object"
> > > >
> > > > When I step through my code, I can see that everything goes well until
> the
> > > > designer tries to call the Parameters property on the Command object.
> > > Because
> > > > my database doesn't support parameters I'm returning null here,
> something
> > > > I've seen in several code examples. As soon as I've exited the
> property I
> > > get
> > > > the error, with the debugger saying it originates from
> > > > Microsoft.ReportDesigner.Design.Query.HasParameters.
> > > >
> > > > Other background information (in no particular order):
> > > > - Before I get to the Parameters property, I see that the GetName and
> > > > GetFieldType properties on my DataReader are called the same number of
> > > times
> > > > as there are columns in my resultset, and then the Dispose method is
> > > called
> > > > on the DataReader.
> > > > - My queries are in XML, and here's the sample I'm using for testing:
> > > > <DVAutoXMLFetch Database="C:\Program Files\IMS
> Health\DATA\DBPINT01.PRM">
> > > > <TimePeriods Count="4">
> > > > <TimePeriod>QTR/3/02</TimePeriod>
> > > > </TimePeriods>
> > > > <Variables Count="3">
> > > > <Variable>UN</Variable>
> > > > </Variables>
> > > > <Dimensions Count="16">
> > > > <Dimension Name="CTY" IsGroup="False" BaseDim="">
> > > > <Member>AUSTRIA</Member>
> > > > </Dimension>
> > > > </Dimensions>
> > > > <FetchDefinition>
> > > > <NumberPrecision ValColNumPrec="1000" ValColRndPrec="1"
> > > CalcColRndPrec="3"
> > > > />
> > > > <AcrossMeasures Count="2">
> > > > <AcrossMeasure Index="1" DimName="TimePeriods" />
> > > > <AcrossMeasure Index="2" DimName="Variables" />
> > > > <Columns Count="1" Rank="0" CalcRank="0" />
> > > > </AcrossMeasures>
> > > > <DownMeasures Count="1">
> > > > <DownMeasure Index="1" DimName="CTY" />
> > > > </DownMeasures>
> > > > </FetchDefinition>
> > > > </DVAutoXMLFetch>
> > > > - I'm running RS SP1 on Windows 2000.
> > > > - I can post the source code if anyone wants...
> > > >
> > > > Thanks in advance for any hints!
> > > >
> > > > Chris
> > > >
> > >
> > >
> > >
>
>|||It may be if the issue was security related. The idea behind the ReportHost
(F5), is to allow the report author to simulate the Report Server
(production) environment by applying the security settings from the
rspreviewpolicy.config.
--
Hope this helps.
----
Teo Lachev, MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
----
"Chris Webb" <OnlyForPostingToNewsgroups@.hotmail.com> wrote in message
news:44823615-9F6C-4477-A3DD-ECDCF43BE81A@.microsoft.com...
> Teo,
> I did that and still had no luck - and then saw the bug by accident and
> fixed it. Everything now seems to run fine, but it did make me wonder - I
was
> debugging the devenv.exe process, but when you run a report in preview
> (rather than build it) does it spawn a new process? That might explain my
> problems debugging it, no?
> Thanks for all your help,
> Chris
> "Teo Lachev" wrote:
> > Chris,
> >
> > Not from the top of my head. Could you put breakpoints in all public
methods
> > and see after which call the exception is thrown. There must be
something
> > quirky in the data extension itself.
> >
> > --
> > Hope this helps.
> >
> > ----
> > Teo Lachev, MCSD, MCT
> > Author: "Microsoft Reporting Services in Action"
> > Publisher website: http://www.manning.com/lachev
> > Buy it from Amazon.com: http://shrinkster.com/eq
> > Home page and blog: http://www.prologika.com/
> > ----
> >
> > "Chris Webb" <OnlyForPostingToNewsgroups@.hotmail.com> wrote in message
> > news:987083A9-8CE5-4A99-A887-A32247FB8776@.microsoft.com...
> > > Hi Teo,
> > >
> > > Thanks, that solved that problem. I've seen several code examples
which
> > > returned null for Parameters, which presumably must have worked at
some
> > > point; has the behaviour changed since beta 1?
> > >
> > > Anyway, I have a new problem now - the report wizard almost, but I get
a
> > COM
> > > Interop exception when I click Finish. The error originates from
> > >
> >
Microsoft.DataWarehouse.VsIntegration.Designer.Serialization.DataWarehouseCo
> > ntainerManager.CreateDocumentObjectDictionary.
> > > Once again the error is raised from outside my code. Any more ideas?
> > >
> > > Thanks again,
> > >
> > > Chris
> > >
> > > "Teo Lachev" wrote:
> > >
> > > > Chris,
> > > >
> > > > Don't return null. Instead, instantiate your ParameterCollection and
> > return
> > > > it back although it will be emply.
> > > >
> > > > --
> > > > Hope this helps.
> > > >
> > > > ----
> > > > Teo Lachev, MCSD, MCT
> > > > Author: "Microsoft Reporting Services in Action"
> > > > Publisher website: http://www.manning.com/lachev
> > > > Buy it from Amazon.com: http://shrinkster.com/eq
> > > > Home page and blog: http://www.prologika.com/
> > > > ----
> > > >
> > > > "Chris Webb" <OnlyForPostingToNewsgroups@.hotmail.com> wrote in
message
> > > > news:7373D28A-BDDA-450B-B1DC-53605BF8C821@.microsoft.com...
> > > > > Hi all,
> > > > >
> > > > > I'm trying to develop a custom data extension for a proprietary
> > database
> > > > we
> > > > > use, and I'm running into problems. I've built a test harness for
it
> > and
> > > > it
> > > > > works fine; however when I try to use it with RS I get the
following
> > error
> > > > > just after having entered my query and pressed Next in the New
Report
> > > > wizard:
> > > > > "An error occurred while the query design method was being saved.
> > Object
> > > > > reference not set to an instance of an object"
> > > > >
> > > > > When I step through my code, I can see that everything goes well
until
> > the
> > > > > designer tries to call the Parameters property on the Command
object.
> > > > Because
> > > > > my database doesn't support parameters I'm returning null here,
> > something
> > > > > I've seen in several code examples. As soon as I've exited the
> > property I
> > > > get
> > > > > the error, with the debugger saying it originates from
> > > > > Microsoft.ReportDesigner.Design.Query.HasParameters.
> > > > >
> > > > > Other background information (in no particular order):
> > > > > - Before I get to the Parameters property, I see that the GetName
and
> > > > > GetFieldType properties on my DataReader are called the same
number of
> > > > times
> > > > > as there are columns in my resultset, and then the Dispose method
is
> > > > called
> > > > > on the DataReader.
> > > > > - My queries are in XML, and here's the sample I'm using for
testing:
> > > > > <DVAutoXMLFetch Database="C:\Program Files\IMS
> > Health\DATA\DBPINT01.PRM">
> > > > > <TimePeriods Count="4">
> > > > > <TimePeriod>QTR/3/02</TimePeriod>
> > > > > </TimePeriods>
> > > > > <Variables Count="3">
> > > > > <Variable>UN</Variable>
> > > > > </Variables>
> > > > > <Dimensions Count="16">
> > > > > <Dimension Name="CTY" IsGroup="False" BaseDim="">
> > > > > <Member>AUSTRIA</Member>
> > > > > </Dimension>
> > > > > </Dimensions>
> > > > > <FetchDefinition>
> > > > > <NumberPrecision ValColNumPrec="1000" ValColRndPrec="1"
> > > > CalcColRndPrec="3"
> > > > > />
> > > > > <AcrossMeasures Count="2">
> > > > > <AcrossMeasure Index="1" DimName="TimePeriods" />
> > > > > <AcrossMeasure Index="2" DimName="Variables" />
> > > > > <Columns Count="1" Rank="0" CalcRank="0" />
> > > > > </AcrossMeasures>
> > > > > <DownMeasures Count="1">
> > > > > <DownMeasure Index="1" DimName="CTY" />
> > > > > </DownMeasures>
> > > > > </FetchDefinition>
> > > > > </DVAutoXMLFetch>
> > > > > - I'm running RS SP1 on Windows 2000.
> > > > > - I can post the source code if anyone wants...
> > > > >
> > > > > Thanks in advance for any hints!
> > > > >
> > > > > Chris
> > > > >
> > > >
> > > >
> > > >
> >
> >
> >|||Using Custom data Extensions , i am able to pass a dataset to my report. All goes fine as long as i dont need a parameter to pass to my stored procedure which i execute from my CDE. But i now need to pass a parameter to it for it to return a dataset.Please help.I have spend lots of time over this but have not yet goy the soluion
From http://www.developmentnow.com/g/115_2004_9_0_0_450456/Custom-Data-Extension-problems.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com

Custom Data Extension Parameters

I am currently writing a Custom Data Extension using the RS 2000
Microsoft.ReportingServices.Interfaces dll. Iâ've found quite a few examples
online and have almost gotten it to work the way I would like it to. I have
implemented the IDbCommandAnalysis.GetParameters interface and when I create
a report with the report designer (VS 2003) the parameters are auto created
in the data layer and the display layer (what is prompted to the user). The
issue I am running into is that parameter type is not being selected within
the display layer. It remains as the default value of string. Does anyone
know how the designer determines what the type is when it is auto creating
the parameters? Iâ'm pretty sure this is possible since it behaves that way
with the prepackaged Microsoft data extensions. What do I need to implement
to get that to work?
Thanks,
-Nathan F.If you implemented the necessary interfaces, then your parameter class
stores the values of the parameters in an object. This object can then
call getType() later on, which is how I am assuming the designer
determines what type of input it is. In essence you shouldn't need to
add any code to figure out the type of the parameter, but you should
code so that you can figure out what types would go where. Most likely
you will just be placing strings inside your parameters since the
command itself will just be a string. Hope this helps!
Lance M.
Nathan wrote:
> I am currently writing a Custom Data Extension using the RS 2000
> Microsoft.ReportingServices.Interfaces dll. I've found quite a few examples
> online and have almost gotten it to work the way I would like it to. I have
> implemented the IDbCommandAnalysis.GetParameters interface and when I create
> a report with the report designer (VS 2003) the parameters are auto created
> in the data layer and the display layer (what is prompted to the user). The
> issue I am running into is that parameter type is not being selected within
> the display layer. It remains as the default value of string. Does anyone
> know how the designer determines what the type is when it is auto creating
> the parameters? I'm pretty sure this is possible since it behaves that way
> with the prepackaged Microsoft data extensions. What do I need to implement
> to get that to work?
> Thanks,
> -Nathan F.

Custom data extension has trust issues

I wrote a custom data processing extension which works in preview mode,
but when viewing it from the report server I get the error:
--
An error has occurred during report processing. (rsProcessingAborted)
Cannot create command for data source 'MeridiumDataSource'.
(rsErrorCreatingCommand)
That assembly does not allow partially trusted callers.
--
I have put the correct codeblock tags in rssrvpolicy.config, right
after the codeblock with Url="$CodeGen$/*" as I'm supposed to:
--
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="MeridiumCodeGroup"
Description="Code group for my data processing extension">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting
Services\ReportServer\bin\MeridiumDataEx
tension.dll"
/>
</CodeGroup>
--
I have some 3rd party assemblies that my DPE references; I also put a
codeblock for them in rssrvpolicy.config:
--
<CodeGroup
class="UnionCodeGroup"
version="3.2.0.148"
PermissionSetName="FullTrust"
Name="MeridiumCoreCodeGroup"
Description="This code group grants Meridium core code full
trust. ">
<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="[public key]"
/>
</CodeGroup>
--
I also put the followinig line in my AssemblyInfo.cs file:
--
[assembly: AllowPartiallyTrustedCallers]
--
None of these things changed the error. Any help would be greatly
appreciated.I guess I forgot to mention that this data extension is for reporting
services, and that this is sql server 2005.|||You might consider posting in the sqlserver.reportingsvcs newgroup.
Arnie Rowland, YACE*
"To be successful, your heart must accompany your knowledge."
*Yet Another certification Exam
<hokietoner@.gmail.com> wrote in message
news:1150980095.588318.45210@.p79g2000cwp.googlegroups.com...
>I wrote a custom data processing extension which works in preview mode,
> but when viewing it from the report server I get the error:
> --
> An error has occurred during report processing. (rsProcessingAborted)
> Cannot create command for data source 'MeridiumDataSource'.
> (rsErrorCreatingCommand)
> That assembly does not allow partially trusted callers.
> --
> I have put the correct codeblock tags in rssrvpolicy.config, right
> after the codeblock with Url="$CodeGen$/*" as I'm supposed to:
> --
> <CodeGroup
> class="UnionCodeGroup"
> version="1"
> PermissionSetName="FullTrust"
> Name="MeridiumCodeGroup"
> Description="Code group for my data processing extension">
> <IMembershipCondition
> class="UrlMembershipCondition"
> version="1"
> Url="C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting
> Services\ReportServer\bin\MeridiumDataEx
tension.dll"
> />
> </CodeGroup>
> --
> I have some 3rd party assemblies that my DPE references; I also put a
> codeblock for them in rssrvpolicy.config:
> --
> <CodeGroup
> class="UnionCodeGroup"
> version="3.2.0.148"
> PermissionSetName="FullTrust"
> Name="MeridiumCoreCodeGroup"
> Description="This code group grants Meridium core code full
> trust. ">
> <IMembershipCondition
> class="StrongNameMembershipCondition"
> version="1"
> PublicKeyBlob="[public key]"
> />
> </CodeGroup>
> --
> I also put the followinig line in my AssemblyInfo.cs file:
> --
> [assembly: AllowPartiallyTrustedCallers]
> --
> None of these things changed the error. Any help would be greatly
> appreciated.
>

Custom data extension has trust issues

I wrote a custom data processing extension for reporting services in
SQL Server 2005. The extension works in preview mode, but when viewing
it from the report server I get the error:
--
An error has occurred during report processing. (rsProcessingAborted)
Cannot create command for data source 'MeridiumDataSource'.
(rsErrorCreatingCommand)
That assembly does not allow partially trusted callers.
--
I have put the correct codeblock tags in rssrvpolicy.config, right
after the codeblock with Url="$CodeGen$/*" as I'm supposed to:
--
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="MeridiumCodeGroup"
Description="Code group for my data processing extension">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting
Services\ReportServer\bin\MeridiumDataExtension.dll"
/>
</CodeGroup>
--
I have some 3rd party assemblies that my DPE references; I also put a
codeblock for them in rssrvpolicy.config:
--
<CodeGroup
class="UnionCodeGroup"
version="3.2.0.148"
PermissionSetName="FullTrust"
Name="MeridiumCoreCodeGroup"
Description="This code group grants Meridium core code full
trust. ">
<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="[public key]"
/>
</CodeGroup>
--
I also put the followinig line in my AssemblyInfo.cs file:
--
[assembly: AllowPartiallyTrustedCallers]
--
None of these things changed the error. I also recently tried using
mscorcfg.msc to create a code group giving everything in the bin folder
(including all of my DLL's), and then I copied that codegroup to the RS
config file. This failed to change anything as well. Any help would be
greatly appreciated!Hi Ryan.
I have worked a lot with extensions and have had a lot of security issues.
I think the easiest way to find out which assembly needs permissions is to
debug. Step through you code and when a unthrusted method is called you will
get an exception.
Your third party assemblies might call something that need to be thrusted?
Kind regards
Martin Bring (Sogeti AB)
********************
"Ryan" wrote:
> I wrote a custom data processing extension for reporting services in
> SQL Server 2005. The extension works in preview mode, but when viewing
> it from the report server I get the error:
> --
> An error has occurred during report processing. (rsProcessingAborted)
> Cannot create command for data source 'MeridiumDataSource'.
> (rsErrorCreatingCommand)
> That assembly does not allow partially trusted callers.
> --
> I have put the correct codeblock tags in rssrvpolicy.config, right
> after the codeblock with Url="$CodeGen$/*" as I'm supposed to:
> --
> <CodeGroup
> class="UnionCodeGroup"
> version="1"
> PermissionSetName="FullTrust"
> Name="MeridiumCodeGroup"
> Description="Code group for my data processing extension">
> <IMembershipCondition
> class="UrlMembershipCondition"
> version="1"
> Url="C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting
> Services\ReportServer\bin\MeridiumDataExtension.dll"
> />
> </CodeGroup>
> --
> I have some 3rd party assemblies that my DPE references; I also put a
> codeblock for them in rssrvpolicy.config:
> --
> <CodeGroup
> class="UnionCodeGroup"
> version="3.2.0.148"
> PermissionSetName="FullTrust"
> Name="MeridiumCoreCodeGroup"
> Description="This code group grants Meridium core code full
> trust. ">
> <IMembershipCondition
> class="StrongNameMembershipCondition"
> version="1"
> PublicKeyBlob="[public key]"
> />
> </CodeGroup>
> --
> I also put the followinig line in my AssemblyInfo.cs file:
> --
> [assembly: AllowPartiallyTrustedCallers]
> --
> None of these things changed the error. I also recently tried using
> mscorcfg.msc to create a code group giving everything in the bin folder
> (including all of my DLL's), and then I copied that codegroup to the RS
> config file. This failed to change anything as well. Any help would be
> greatly appreciated!
>

Custom Data Extension - Query String

Hi,
--Question
I have a created a custom data extension and I want to populate the query
string with some default text, how can I do this? I've initialised the
command text property to my desired default but it always shows an empty
string in the designer? I've included the background as to why I want to do
this below.
Any help would be much appreciated
--Background info
I have created a custom data extension which works just fine when I hard
code the 3 parameters required. These parameters are actually instruction for
my DAL to work with so they are essential to know up front, rather than
typical parameters that would be passed to a SP to filter data. My parameters
are XmlConfigFile and DataProviderID, my DAL then creates an object using
info from the config file for the specified DataProviderID. Since these
params are essential to return any data I want them to be passed via the
query string, I also want the default query string to have them populated
with empty strings
e.g. @.XmlConfigFile='' ; @.DataProviderId=''
This way the report designer just needs to add the values an not remember
the parameter names.The CommandText property gets set by report designer based on the
user-specified values. From the designer point of view, the CommandText
property is "set-only". It will never get the value of the property.
Not sure if this would work for your situation, but you could generate a
"report template" which has a prepopulated dataset with command text.
Instead of creating a new report, report authors should instead create the
new report based of that template.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Neil" <Neil@.discussions.microsoft.com> wrote in message
news:BDF78560-A993-4CBD-A126-3B8DB7D70C2E@.microsoft.com...
> Hi,
> --Question
> I have a created a custom data extension and I want to populate the query
> string with some default text, how can I do this? I've initialised the
> command text property to my desired default but it always shows an empty
> string in the designer? I've included the background as to why I want to
> do
> this below.
> Any help would be much appreciated
> --Background info
> I have created a custom data extension which works just fine when I hard
> code the 3 parameters required. These parameters are actually instruction
> for
> my DAL to work with so they are essential to know up front, rather than
> typical parameters that would be passed to a SP to filter data. My
> parameters
> are XmlConfigFile and DataProviderID, my DAL then creates an object using
> info from the config file for the specified DataProviderID. Since these
> params are essential to return any data I want them to be passed via the
> query string, I also want the default query string to have them populated
> with empty strings
> e.g. @.XmlConfigFile='' ; @.DataProviderId=''
> This way the report designer just needs to add the values an not remember
> the parameter names.

Custom Data Extension - Designer Extension Could Not Be Loaded

Hi All,

I've managed (finally) to get a Custom Data Extension to work in Reporting Services 2005. The next problem I have is that whenever I click on the "data" tab when creating a report (from Visual Studio 2005) an error appears: "The designer extension <ext name> could not be loaded. Check the configuration file RsReportDesigner.config".

Is there some way of getting rid of this error message? Such as creating a designer, if so does anyone know how (I don't need the designer to do anything, just not crash)? I can still modify the data for the report etc its just annoying that's all.

Cheers,

Dan.

Make sure that you have your data extension registered in the
RSReportDesigner.config file, located here: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\. Also, to use the generic query designer, be sure to add the following line to the <Designer> element of the config file (changed to use the name of your data extension).

<Extension Name="DataExtrensionName" Type="Microsoft.ReportingServices.QueryDesigners.GenericQueryDesigner,Microsoft.ReportingServices.QueryDesigners"/>

Ian|||

Hi Ian,

Thanks for the quick reply that worked a treat! Nice one.

I'm guessing there is a way to create your own designers? I'll look into the QueryDesigners namespace and have a poke about :-)

Thanks again,

Dan.

Custom Data Extension

I know that SRS Enterprise Edition (EE) is needed to implement a custom
security extension. Do I need Enterprise too if I want to implement a
custom data extension?
TIA.You shouldn't as noted here:
http://www.microsoft.com/sql/reporting/productinfo/features.asp
--
Hope this helps.
---
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---
"TechnoSpyke" <technospyke@.yahoo.com> wrote in message
news:uKfS3ZS3EHA.4092@.TK2MSFTNGP14.phx.gbl...
> I know that SRS Enterprise Edition (EE) is needed to implement a custom
> security extension. Do I need Enterprise too if I want to implement a
> custom data extension?
> TIA.
>

Custom data extension

hello,
I'm implementing a data extension and I need to have the connection "edit"
button available (since I'm using a connection to SqlServer). I don't see
any property/member from IDbConnection and IDbConnectionExtension.
Thanks,
Pierre
--
---
Pierre Greborio
Microsoft .NET MVP
http://www.ugidotnet.org
http://www.amazon.com/infopath
---The connection "edit" button is disabled for custom data extensions by
design, because the Data Link dialog requires an OLEDB connection string and
logic is built into the designer that can translate the connection strings
for our standard provider types to these OLEDB connection strings. This
cannot be done for a general custom extension, because in a custom
extension, a connection string can be anything.
We are considering adding support for custom connection string builder
dialogs that will be tied to the Edit button in a future release.
For now, you will have to manually enter your connection string in the Data
Source dialog.
--
Jerry Povse
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Pierre Greborio" <pierreANTI_SPAM@.pierregreborio.it> wrote in message
news:em8kTCEZEHA.716@.TK2MSFTNGP11.phx.gbl...
> hello,
> I'm implementing a data extension and I need to have the connection "edit"
> button available (since I'm using a connection to SqlServer). I don't see
> any property/member from IDbConnection and IDbConnectionExtension.
> Thanks,
> Pierre
> --
> ---
> Pierre Greborio
> Microsoft .NET MVP
> http://www.ugidotnet.org
> http://www.amazon.com/infopath
> ---
>|||Jerry Povse [MSFT] wrote:
> The connection "edit" button is disabled for custom data extensions by
> design, because the Data Link dialog requires an OLEDB connection
> string and logic is built into the designer that can translate the
> connection strings for our standard provider types to these OLEDB
> connection strings. This cannot be done for a general custom
> extension, because in a custom extension, a connection string can be
> anything.
> We are considering adding support for custom connection string builder
> dialogs that will be tied to the Edit button in a future release.
> For now, you will have to manually enter your connection string in
> the Data Source dialog.
Thanks a lot Jerry. Happy to know that it will be availabe for next release.
thanks,
Pierre
--
---
Pierre Greborio
Microsoft .NET MVP
http://www.ugidotnet.org
http://www.amazon.com/infopath
---

Custom Data Ext. Query Editor trouble

I created a custom data extension for reporting services in C#.
The CDE implements a dataset with one datatable now but I can't get it to
display in the query editor in the data tab of the report designer.
Any ideas on what needs to be done to expose it and additional data tables
to the query editor for some easy point and click query building?
thanksHave you added to required entries into the RSReportDesigner.config and
RSReportServer.config?
"paul" wrote:
> I created a custom data extension for reporting services in C#.
> The CDE implements a dataset with one datatable now but I can't get it to
> display in the query editor in the data tab of the report designer.
> Any ideas on what needs to be done to expose it and additional data tables
> to the query editor for some easy point and click query building?
> thanks|||Thanks for the reply.
I did add the necessary entries to the rsreportdesigner.config file.
For viewing the report in VS2005 though, both in the data and preview panes,
I'm not sure why I'd need to add any entries to the rsreportserver.config
file?
"SvdSinner" wrote:
> Have you added to required entries into the RSReportDesigner.config and
> RSReportServer.config?
> "paul" wrote:
> > I created a custom data extension for reporting services in C#.
> >
> > The CDE implements a dataset with one datatable now but I can't get it to
> > display in the query editor in the data tab of the report designer.
> >
> > Any ideas on what needs to be done to expose it and additional data tables
> > to the query editor for some easy point and click query building?
> >
> > thanks

custom count within group crystal XI

Hi,

I need to count number of consequtive weeks within a group:

Group_name consequtive: 2
person1 7/5/07
person2 7/19/07
person3 7/26/07


Consequtive is equal to 2 within this group, since person 2 and 3 are 1 week apart.

anybody know how to code this in CR XI?

thx in advanceUse the DateDiff function. If the DateDiff (w) of the previous week to this week = 1, then increment a running total by 1.

Custom ControlFlow

I am trying to design a Component which can be configured by a UI. After Configuration from the Design pane the Data should be passed to the back-end of the Component.
When I look at some code samples I only see, that it's possible to pass simple data.
What I want is to put a grid on the UI and connect it to a DataTable. This is used for displaying and changing a configuration as a table.
Well, the question is: Can I pass the DataTable object to the backend-DLL as is? If so then how?
THX
Fridtjof
Can you please clarify whether you are creating a custom Task or a custom Data Flow Component, or another type of run-time object like a connection manager? The APIs are similar but not identical.

-Doug
|||From your subect I assume you mean a Task. Why can you not just create a property of your task, typed as a DataTable?|||Well I don't have any instance of the Backend Class in the Definition of the UI-Class, have I?
If I had one there would be no problem setting the DataSource of the Grid to that DataTable.
|||

You keep referring to the backend-class, do you mean the task itself, the class that inherits from Task?

If so you should have a reference to it in the UI. You need to cache it and pass it through, but otherwise there is not much point to the UI.

Review this code form one of my tasks. This is the UI class, the one that inherits from IDtsTaskUI. My form is ZipFileTaskUIForm, and has a modified constructor to accept the parameters passed through. You can see the TaskHost is cached in Initialize, and then passed to the form. This is how you get a reference to your task into the form.


public System.Windows.Forms.ContainerControl GetView()
{
return new ZipFileTaskUIForm(_taskHost, _dtsConnectionService, _dtsVariableService);
}
public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
{
_taskHost = taskHost;

IDtsVariableService dtsVariableService = serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;
IDtsConnectionService dtsConnectionService = serviceProvider.GetService(typeof(IDtsConnectionService)) as IDtsConnectionService;
_dtsConnectionService = dtsConnectionService;
_dtsVariableService = dtsVariableService;
}


|||To your question: Yes I mean the class which inherits from Task! That's what I call Backend-Class.
Your code is from the Class which inherits from IDtsTaskUI.
The question is how can you access public members of my Backend-Class in the UI (Form).
Maybe I have to convert and cache then, because the ui is called at design-time and the Backend at runtime?
|||Your form should be invoked from the UI class (IDtsTaskUI). The sample I showed demonstrates grabbing TaskHost, and passing it through to the form. You use the TaskHost to access properies of the task itself. You cannot get direct access to the Task instance, but you should not actually need to as you have TaskHost instead.
If you have code that you wish to share between trasjk and UI classes, then make them public static. Instance members would not work anyway since you cannot get the instance.

|||In addition to the Initialize method in the UI class that comes from the IDtsXxxUI interface, I would be inclined to write an Initialize method of my own in my Windows Forms class and pass along a reference to my task or other object, so I can easily read its current property values to set initial control states and values, then update its properties from the controls when the user closes the form.

So Task passes reference to itself in calling Initialize in Task UI class, and Task UI class passes reference to task in calling custom Initialize method in Task UI Form class.

-Doug
|||

I am also facing same problem. When i explored i came to know that there was two method SaveToXML() and LoadXML() of IDTSPersist90 interface to handle this type of scenerio. But i could not able to raise these methods. you can transfer either string or interger...etc, but if you want to transfer some custom object i think you have to preserve the same in xml and retrieve it when ever needed

...Karun

|||

As I understand the issue, bearing in mind this thread crossed several, none of which matched the title that well, but you are writing a task and have a complex type that you need to persist. All persistance is through XML, and for complex stuff you need to implement IDTSPersist90 yourself. The methods are never called by you, they are called by the designer. You fill in the code to save and load the values to and from the XML document provided, and you can choose how you store the information in the XML.

For objects, I found the easiest way to to serialize them, and actually binary serialization at that. This snippet gives me a string that I can easily store in an xml element for the property.

public static string SerializeObject(object graph) { BinaryFormatter formatter1 = new BinaryFormatter(); MemoryStream stream1 = new MemoryStream(); formatter1.Serialize(stream1, graph); string text1 = Convert.ToBase64String(stream1.GetBuffer()); stream1.Close(); return text1; }

Another alternative is to use reflection to read an object's properties, and then build up an XML node that represents this. Here is an example of creating a new element with sub elements for each property-

public static XmlElement AddXmlObjectProperties(XmlElement parentElement, string propertyName, object propertyObject) { XmlElement element1 = XMLPersistanceHelper.AddXmlElement(parentElement, propertyName); Type type1 = propertyObject.GetType(); foreach (PropertyInfo info1 in type1.GetProperties()) { Type type2 = info1.PropertyType; string text1 = type2.Name; object obj1 = info1.GetValue(propertyObject, null); if (type2.IsEnum) { obj1 = Convert.ToInt32(info1.GetValue(propertyObject, null)); } if (obj1 != null) { XmlElement element2 = XMLPersistanceHelper.AddXmlElement(element1, "Property", obj1.ToString()); XMLPersistanceHelper.AddXmlAttribute(element2, "Name", info1.Name); XMLPersistanceHelper.AddXmlAttribute(element2, "Type", text1); } } return element1; }

Custom ControlFlow

I am trying to design a Component which can be configured by a UI. After Configuration from the Design pane the Data should be passed to the back-end of the Component.
When I look at some code samples I only see, that it's possible to pass simple data.
What I want is to put a grid on the UI and connect it to a DataTable. This is used for displaying and changing a configuration as a table.
Well, the question is: Can I pass the DataTable object to the backend-DLL as is? If so then how?
THX
Fridtjof
Can you please clarify whether you are creating a custom Task or a custom Data Flow Component, or another type of run-time object like a connection manager? The APIs are similar but not identical.

-Doug
|||From your subect I assume you mean a Task. Why can you not just create a property of your task, typed as a DataTable?|||Well I don't have any instance of the Backend Class in the Definition of the UI-Class, have I?
If I had one there would be no problem setting the DataSource of the Grid to that DataTable.
|||

You keep referring to the backend-class, do you mean the task itself, the class that inherits from Task?

If so you should have a reference to it in the UI. You need to cache it and pass it through, but otherwise there is not much point to the UI.

Review this code form one of my tasks. This is the UI class, the one that inherits from IDtsTaskUI. My form is ZipFileTaskUIForm, and has a modified constructor to accept the parameters passed through. You can see the TaskHost is cached in Initialize, and then passed to the form. This is how you get a reference to your task into the form.


public System.Windows.Forms.ContainerControl GetView()
{
return new ZipFileTaskUIForm(_taskHost, _dtsConnectionService, _dtsVariableService);
}
public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
{
_taskHost = taskHost;

IDtsVariableService dtsVariableService = serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;
IDtsConnectionService dtsConnectionService = serviceProvider.GetService(typeof(IDtsConnectionService)) as IDtsConnectionService;
_dtsConnectionService = dtsConnectionService;
_dtsVariableService = dtsVariableService;
}


|||To your question: Yes I mean the class which inherits from Task! That's what I call Backend-Class.
Your code is from the Class which inherits from IDtsTaskUI.
The question is how can you access public members of my Backend-Class in the UI (Form).
Maybe I have to convert and cache then, because the ui is called at design-time and the Backend at runtime?
|||Your form should be invoked from the UI class (IDtsTaskUI). The sample I showed demonstrates grabbing TaskHost, and passing it through to the form. You use the TaskHost to access properies of the task itself. You cannot get direct access to the Task instance, but you should not actually need to as you have TaskHost instead.
If you have code that you wish to share between trasjk and UI classes, then make them public static. Instance members would not work anyway since you cannot get the instance.

|||In addition to the Initialize method in the UI class that comes from the IDtsXxxUI interface, I would be inclined to write an Initialize method of my own in my Windows Forms class and pass along a reference to my task or other object, so I can easily read its current property values to set initial control states and values, then update its properties from the controls when the user closes the form.

So Task passes reference to itself in calling Initialize in Task UI class, and Task UI class passes reference to task in calling custom Initialize method in Task UI Form class.

-Doug
|||

I am also facing same problem. When i explored i came to know that there was two method SaveToXML() and LoadXML() of IDTSPersist90 interface to handle this type of scenerio. But i could not able to raise these methods. you can transfer either string or interger...etc, but if you want to transfer some custom object i think you have to preserve the same in xml and retrieve it when ever needed

...Karun

|||

As I understand the issue, bearing in mind this thread crossed several, none of which matched the title that well, but you are writing a task and have a complex type that you need to persist. All persistance is through XML, and for complex stuff you need to implement IDTSPersist90 yourself. The methods are never called by you, they are called by the designer. You fill in the code to save and load the values to and from the XML document provided, and you can choose how you store the information in the XML.

For objects, I found the easiest way to to serialize them, and actually binary serialization at that. This snippet gives me a string that I can easily store in an xml element for the property.

public static string SerializeObject(object graph) { BinaryFormatter formatter1 = new BinaryFormatter(); MemoryStream stream1 = new MemoryStream(); formatter1.Serialize(stream1, graph); string text1 = Convert.ToBase64String(stream1.GetBuffer()); stream1.Close(); return text1; }

Another alternative is to use reflection to read an object's properties, and then build up an XML node that represents this. Here is an example of creating a new element with sub elements for each property-

public static XmlElement AddXmlObjectProperties(XmlElement parentElement, string propertyName, object propertyObject) { XmlElement element1 = XMLPersistanceHelper.AddXmlElement(parentElement, propertyName); Type type1 = propertyObject.GetType(); foreach (PropertyInfo info1 in type1.GetProperties()) { Type type2 = info1.PropertyType; string text1 = type2.Name; object obj1 = info1.GetValue(propertyObject, null); if (type2.IsEnum) { obj1 = Convert.ToInt32(info1.GetValue(propertyObject, null)); } if (obj1 != null) { XmlElement element2 = XMLPersistanceHelper.AddXmlElement(element1, "Property", obj1.ToString()); XMLPersistanceHelper.AddXmlAttribute(element2, "Name", info1.Name); XMLPersistanceHelper.AddXmlAttribute(element2, "Type", text1); } } return element1; }