Showing posts with label dll. Show all posts
Showing posts with label dll. Show all posts

Tuesday, March 20, 2012

custom SSIS with ATL dll

Hi All,Is it possible to create SSIS custom component with ATL COM dll with MFC support?I'm not familar with C# & VB# languages :-(Regards,Svilen Varbanov

Yes, it's possible but not supported. To get an idea what interfaces you need to implement, take a look at the DTS.DLL file in OLEVIEW. You need to implement IDTSTask90, IDTSComponentPersist90 for the basic implementation. If you want to do more advanced things like create custom events, custom log events, build breakpoints etc. there are other interfaces to support. Several of the stock tasks are written in native code including the dataflow, execute package and some parts of the MSMQ task.

Kirk Haselden Author "SQL Server Integration Services"|||

Thanks!

It seems C++ is obsolete prorgamming language.... :-( Now I have find out a way to convert DTS package written in C++ 6.0 into managed dll written in C#... I can't believe...

Regards,

Svilen Varbanov

Monday, March 19, 2012

Custom Report Item example not rendering right?

I'm trying to work with the custom report item example (PolygonsCRI.dll) from the latest SQL Server 2005 downloads. I've followed all of the instructions on how to deploy the report. The report is now available on my Report Server, and I can load the Polygons.sln report and view it in the designer. However, whenever I preview the report in the designer or view the report on the server, the polygon report items just show up as big blank spots - there's no image there and no indication of an error. The chart on the report renders just fine, though.

Does anybody have any ideas on what could be causing this?

Thanks,

Glenn Burnsider

There is a typo in the PolygonsCRI.vb and .cs file. The class name should be "PolygonsCRI", not "PolygonsCCustomReportItem". Change the class name to "PolygonsCRI", redeploy, and the chart should be visible now.

Custom Report Item example not rendering right?

I'm trying to work with the custom report item example (PolygonsCRI.dll) from the latest SQL Server 2005 downloads. I've followed all of the instructions on how to deploy the report. The report is now available on my Report Server, and I can load the Polygons.sln report and view it in the designer. However, whenever I preview the report in the designer or view the report on the server, the polygon report items just show up as big blank spots - there's no image there and no indication of an error. The chart on the report renders just fine, though.

Does anybody have any ideas on what could be causing this?

Thanks,

Glenn Burnsider

There is a typo in the PolygonsCRI.vb and .cs file. The class name should be "PolygonsCRI", not "PolygonsCCustomReportItem". Change the class name to "PolygonsCRI", redeploy, and the chart should be visible now.

Thursday, March 8, 2012

Custom extensions and multiple tables

Is it possible to create a custom extension (DLL) that will push multiple
tables (or datasetes) into SQL report? If not what is a way to push
multiple datasets into report?
Thanksyou can use 1 data set in each data region and have multiple data regions in
a single report..
But if you are talking about having multiple tables in a single data region,
you might try using the SQL UNION statement ie
select name, address, zip from employees
union
select name, address, zip from customers
If the tables are dis-similar you might think of using a join in your
query..
hope this helps.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Mark Goldin" <markgoldin@.comcast.net> wrote in message
news:OOmhR2lwEHA.2012@.TK2MSFTNGP15.phx.gbl...
> Is it possible to create a custom extension (DLL) that will push multiple
> tables (or datasetes) into SQL report? If not what is a way to push
> multiple datasets into report?
> Thanks
>|||I guess my question is how to push (not to pull) into RS multiple datasets
using custom extentions.
"Wayne Snyder" wrote:
> you can use 1 data set in each data region and have multiple data regions in
> a single report..
> But if you are talking about having multiple tables in a single data region,
> you might try using the SQL UNION statement ie
> select name, address, zip from employees
> union
> select name, address, zip from customers
> If the tables are dis-similar you might think of using a join in your
> query..
> hope this helps.
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Mark Goldin" <markgoldin@.comcast.net> wrote in message
> news:OOmhR2lwEHA.2012@.TK2MSFTNGP15.phx.gbl...
> > Is it possible to create a custom extension (DLL) that will push multiple
> > tables (or datasetes) into SQL report? If not what is a way to push
> > multiple datasets into report?
> >
> > Thanks
> >
> >
>
>

Wednesday, March 7, 2012

Custom DLL #Error Issue -Really Critical - Need your Help to Sort out the Issue

Hi MSTR Mentors,
I am in need of your Help... I am having this issue for a very long
time...Hope I will get a solution from you guys...
We have a Custom .net dll, referred in the RDL, the dll has a function
which gets the encrypted Credit Card# and returns the Decrypted value to
the Report.
I have done all the steps listed below
1. Assert permissions in your custom assembly.
2. Make the custom assembly available to Report Designer and to Report
Server.
3. Reference the custom assembly in your report.
4. Modify the code access security settings for your custom assembly.
Ref: http://support.microsoft.com/?kbid=842419#XSLTH3133121123120121120120
Step 1: I have added the following code to Assert Permission.
SecurityPermission secPerm = new SecurityPermission
(PermissionState.Unrestricted);
secPerm.Assert(); - Is this Assert Permission Correct
Step 2: Copied the assembly to the following locations
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\
bin
&
C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer
Step 3: Reference the custom assembly in the report (thru Report Properties)
Step 4: Modify the code access security for the custom assembly by creating
new permission set and code groups.
Copy the code from the security.config(C:\WINNT\Microsoft.NET\Framework\
v1.1.4322\CONFIG\) and paste it in
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\
rssrvpolicy.config
&
C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\
rspreviewpolicy.config
PERMISSION SET
<PermissionSet class="NamedPermissionSet"
version="1"
Name="ILNReportsPermissionSet">
<IPermission class="SecurityPermission"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
CODE GROUP
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="TESTPS"
Name="TESTCG"
Description="">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="file://C:/Program
Files/Microsoft SQL Server/MSSQL/Reporting
Services/ReportServer/bin/CreditCardDecrypt.dll"/>
</CodeGroup>
Save and close the files
The tried to run the report in the DebugLocal Mode - Fails ?
Dll Code: I have attached the custom assembly code.
Note: To make sure the Dll works fine in Web, I have created a sample web
application and tested the dll by passing the values to the dll function It
works fine, but not working with the RDL.
Custom DLL Code
using System;
using System.Text;
using System.Net;
using System.IO;
using System.Collections.Specialized;
using System.Configuration;
using System.Security.Permissions;
using System.Security.Cryptography;
using FCLX509 = System.Security.Cryptography.X509Certificates;
using WSEX509 = Microsoft.Web.Services2.Security.X509;
using WSECRY = Microsoft.Web.Services2.Security.Cryptography;
[assembly:CLSCompliant(true)]
namespace CreditCardDecrypt
{
/// <summary>
/// Summary description for DecryptClass.
/// </summary>
///
public class DecryptClass
{
public DecryptClass()
{
//
// TODO: Add constructor logic here
//
}
public static string DecryptCardInfo(string cc,string subjectName,string
storeName)
{
string sCreditCard = "";
try
{
if(cc == "" || cc== null)
return sCreditCard = "NA";
SecurityPermission secPerm = new SecurityPermission
(PermissionState.Unrestricted);
secPerm.Assert();
WSEX509.X509CertificateStore.StoreLocation location = WSEX509.X509CertificateStore.StoreLocation.LocalMachine;
WSEX509.X509CertificateStore.StoreProvider provider = WSEX509.X509CertificateStore.StoreProvider.System;
WSEX509.X509CertificateStore store = new WSEX509.X509CertificateStore
(provider, location, storeName);
bool fopen = store.OpenRead();
if(fopen)
{
WSEX509.X509CertificateCollection certs = store.FindCertificateBySubjectString(subjectName);
if (certs.Count > 0)
{
WSEX509.X509Certificate cer = certs[0];
WSECRY.RSACryptoServiceProvider rsaCsp = (WSECRY.RSACryptoServiceProvider)cer.Key;
byte[] cipherData = Convert.FromBase64String(cc);
byte[] plainData = rsaCsp.Decrypt(cipherData, false);
sCreditCard = Encoding.UTF8.GetString(plainData);
}
}
if (store != null)
store.Close();
return sCreditCard;
//return cc;
}
catch(Exception ex)
{
return ex.ToString();
}
}
}
}
Thanks
Balaji
Note : This is my email id (bkkrishnan[AT]hotmail.com).
--
Message posted via http://www.sqlmonster.comCan any one please help on this.....
Still can't able to fix the issue
Thanks
Balaji
--
Message posted via http://www.sqlmonster.com

custom DLL

I have a custom DLL in C# which does a lot of calculations.

I need to use it in my DataFlowTask. I wanted to add it as a reference in ScriptComponent and use it from there, but I do not see my dll there.

The dll is sign but does not have Post-build event command filled in the properties of the project and my dll is deployed and installed to assembly.

What do I do wrong?

How can I use my dll in ScripComponent? Any other options? What am I missing?

Thanks.

Vita wrote:

How can I use my dll in ScripComponent?

Take a read of this:

VSA requires DLLs to be in the Microsoft.Net folder (but not all the time)

(http://blogs.conchango.com/jamiethomson/archive/2005/11/02/SSIS_3A00_-VSA-requires-DLLs-to-be-in-the-Microsoft.Net-folder-_2800_but-not-all-the-time_2900_.aspx)

-Jamie

|||

Got it!

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

Would I be able to debug it?

|||

Vita wrote:

Got it!

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

Would I be able to debug it?

Unfortunately you can't step through the code in the script component. The best you can do is use message boxes to provide debugging info.

Stepping through code in the script task should work just fine.

-Jamie

|||

Interesting!

I have not used script task yet.

What can it be used for?

Can I calculate some formulas from the data I have in the Database using my custom dll as reference and update (not insert) a table which has some empty fields. How would I specify for example that one field from one table must be added to another field in another table and update third table based on the id?

Thanks a lot.

|||

Vita wrote:

Interesting!

I have not used script task yet.

What can it be used for?

Can I calculate some formulas from the data I have in the Database using my custom dll as reference and update (not insert) a table which has some empty fields. How would I specify for example that one field from one table must be added to another field in another table and update third table based on the id?

Thanks a lot.

Script Component works in the dataflow which means you execute .Net code on data in your pipeline.

Script Task is a task in the control-flow. You can basically do what you want with it - think of the script task as just another host for the clr.

Does that help?

-Jamie

|||thanks a lot!

custom dll

Hi
For SQL Reporting Services 2000 the custom dll could be deployed to c:/programfiles/MSSQLServer/80/tools/reportDesigner.
But now I am trying to achieve the same with 2005. Can some one let me know where I can deploy the custom dll for SSRS 2005 to use it with reports.
Thanks in advance.

When you deploy your custom dll in SSRS 2000 it must be copied to [MSSQLServerInstallDir]\MSSQL\Reporting Services\ReportServer\Bin folder.
The folder you mentioned is only for design-time support under VS.NET 2003 and not for deployment.

In SSRS 2005 your dll must be copied to [MSSQLServerInstallDir]\MSSQL.2\Reporting Services\ReportServer\Bin (Warning: the path may vary depending on you've installed the Report Server)
For SSRS 2005 design-time support the folder is located at [VS2005InstallDir]\Common7\IDE\PrivateAssemblies\

HTH

Gabriel Fogante
http://neodynamic.blogspot.com/

Custom Delivery for Printer

Hi,
For Reporting Services for SQL Server 2000, we need to write a custom
delivery dll for printer right?
Just wondering has microsoft come out with a sample of it already? Maybe a
sample code or a working DLL already?
Best Regards,
ShelA printer delivery sample shipped with RS 2000. If you run setup you can
install the samples. There is help for the sample in the help
documentation.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Shelby" <shelby@.singnet.com.sg> wrote in message
news:OiSAqH%23AGHA.516@.TK2MSFTNGP15.phx.gbl...
> Hi,
> For Reporting Services for SQL Server 2000, we need to write a custom
> delivery dll for printer right?
> Just wondering has microsoft come out with a sample of it already? Maybe a
> sample code or a working DLL already?
> Best Regards,
> Shel
>

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 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 conflict resolver example code in C#

Hi!

I'm trying to create a custom conflict resolver for SQL Server 2000 in

C# but i can't seem to find any source code examples of a *.dll where i

can actually see what needs to be done.

Any help is welcome.

Thanks

In SQL 2000, you can only do this in VB, C# isn't supported. However in SQL 2005, you can definitely use C#.

|||Thanks,

so that's why i couldn't find anything in C# :/

Going to try and find a different approach then.

Custom conflict resolver example code in C#

Hi!

I'm trying to create a custom conflict resolver for SQL Server 2000 in

C# but i can't seem to find any source code examples of a *.dll where i

can actually see what needs to be done.

Any help is welcome.

Thanks

In SQL 2000, you can only do this in VB, C# isn't supported. However in SQL 2005, you can definitely use C#.

|||Thanks,

so that's why i couldn't find anything in C# :/

Going to try and find a different approach then.

Friday, February 24, 2012

Custom Code in SSAS

Hi,

in AS2000 you could register an own dll to add functionality in MDX for calculations. What is the equivalent in AS2005?

Thanks...

The same except now it is a .NET assembly.

Mosha has some interesting examples on his web site and in his blog.

http://www.mosha.com

http://www.sqljunkies.com/WebLog/mosha/

Enjoy.

_-_-_ Dave

|||

Dave,

thanks, I'll have a look at it...

Custom code assembly with config file

Hi!

My report has a reference to an assembly of a class library I did. This class library has a config file, classLibrary.dll.config, where I set some parameters, one of these being the "initial path" to the project's folder(for example, project folder is myProject, and you would use the initial path to say it's in c:/projects/tests). When I preview the report everything works fine, but when I publish it I get this error:

Absolute path information is required.

I guess it's not reading the dll.config file, so it can't see the initial path value and concatenate it with the project's folder. I'm supposing this because at first, I forgot to copy the dll.config file to the Microsoft Visual Studio 8/Common7/IDE/PrivateAssemblies folder and I got the same error when trying to preview the report. Copying it to this folder solved the problem. So I think I'm not placing the dll.config file in the rigth folder (I'm copying it to Microsoft SQL Server/MSSQL/ReportServer/bin). If I don't use the config file, I mean, if I put the absolute path directly in the code, everything works, but this is just something I can't do! Can anyone help me?

Thank you!

what happens if you copy config file to reportserver/bin and give 'everyone' read access to it?|||

Hi!

It still can't see the config file... My class library has two classes, Class A uses Class B. Can I use only Class A ddl or should I put both dll files in the rssrvpolicy.config?

Thank you!

|||You should put both|||

Hi!

Still have the problem... When I try to preview the assembly location using Assembly.GetExecutingAssembly().Location, it shows me the rigth path to the dll file. When I try to see it from the published report, I get #Erro on the textbox. Is this write?

Thank you!

|||

Take a look at the logfiles at:
\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\LogFiles
Usually they can help you..
Hint:
Stop Reporting Services and WWW-Publishing, delete all old Logfiles, and restart the services. So you can easily find the right logfiles..

|||

Hi!

Thanks for the post, I'll take a look on the log files... But I'm wondering if there is a simpler way to do what I'm trying to do. I'm doing all this because I can't have in my code an absolute path to a xml file configurable by the user. I know that, if it was a web page, I could use Server.MapPath("file.xml") to made it relative to the project path. Can't I do something like this with a Class Library? Or is the config file the only solution?

Thank you!

Sunday, February 19, 2012

Custom Assembly Problems: System.Drawing

Hi,
I built a Custom Assembly to allow me to use external image files in
my report. I deployed the DLL and configured the security policy
config files.
Everything worked great, i got the image coming through to my report
in both Designer Preview mode and when deployed.
I decided to extend the custom assembly to return the dimensions of
the image as well by adding some code that utilizes System.Drawing.DLL
//ok now, lets get the width and height
//FileIOPermission permission = new FileIOPermission
Image myImage = Image.FromFile(pPath);
g_lastHeight = myImage.Height;
g_lastWidth = myImage.Width;
myImage.Dispose();
myImage=null;
After rebuilding and deploying the DLL, my report no longer has any
images when deployed.
However, the images do show up in Designer preview mode, and the DLL
performs correctly returning the image dimensions upon request,
implying a security policy issue'
So my question is what security policy type things do i need to do in
order to utilize System.Drawing.dll in my DLL.
Any help would be greatly appreciated.
Thanks
DerekI believe the correct permission is UIPermission. Please see the following for why it only works in
preview and how to configure the server:
http://msdn.microsoft.com/library/?url=/library/en-us/dnsql2k/html/dngrfCodeAccessSecurityInSQLServer2000ReportingServices.asp?frame=true
Thanks.
Donovan R. Smith
Software Test Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
"Derek W" <derek@.brokerbuilders.com> wrote in message
news:a5df538d.0408161409.6d219516@.posting.google.com...
> Hi,
> I built a Custom Assembly to allow me to use external image files in
> my report. I deployed the DLL and configured the security policy
> config files.
> Everything worked great, i got the image coming through to my report
> in both Designer Preview mode and when deployed.
> I decided to extend the custom assembly to return the dimensions of
> the image as well by adding some code that utilizes System.Drawing.DLL
> //ok now, lets get the width and height
> //FileIOPermission permission = new FileIOPermission
> Image myImage = Image.FromFile(pPath);
> g_lastHeight = myImage.Height;
> g_lastWidth = myImage.Width;
> myImage.Dispose();
> myImage=null;
> After rebuilding and deploying the DLL, my report no longer has any
> images when deployed.
> However, the images do show up in Designer preview mode, and the DLL
> performs correctly returning the image dimensions upon request,
> implying a security policy issue'
> So my question is what security policy type things do i need to do in
> order to utilize System.Drawing.dll in my DLL.
> Any help would be greatly appreciated.
> Thanks
> Derek

Custom Assembly Problems

Hi All,
I am having a problem with a shared assembly I created. I created a
dll and registered it in the GAC of my development machine. Then I
added a new key into my system registry so I could add it into a
project easily when in Visual Studio. It works well when I reference
it in my ASP.NET/VB.NET applications.
In reporting services, I added the reference to the dll in my report
just fine. I call a function in the custom report code, which
references my dll. The function returns a boolean which, within an
"IIf" statement, determines the background color of certain cells. It
does the job, builds without errors or warnings, and previews in
Visual Studio just the way it should. However, after deploying to my
production server, it seems like it is basically ignoring my call to
the shared assembly. I get no errors or warnings, but the background
color of the mentioned cells never gets set.
Is there another reference I am missing? Any other suggestions?
Thanks in advance!Some basic stuff which you may have already tried
1. Extend your assembly code to output a "hello world" string. Do this
by using a variable , setting its value through a parameter and use
error handling to output any errors , instead of the parameter string,
in case of errors.
2. Create a blank report and use the function call to display the
string in a text box
3. Deploy your assembly to the production GAC
4. Deploy your report to the production GAC
If that works , use the same function call to perform bits of your
original code and return a "done" string or the error string after the
function is completed .
That should help you in finding out where you are getting issues.
Best of luck
Cheers
Shai|||How do you deploy a report to the GAC?|||On Nov 30, 6:48 am, John <john.n.b...@.gmail.com> wrote:
> How do you deploy a report to the GAC?
Sorry , thats was a typo. I meant deploy the report to production
environment
Cheers
Shai

Friday, February 17, 2012

custom assembly in RS

I'm trying to create a DLL that I can use with:
A) an ASP ("classic" ASP, not .NET)
B) a Reporting Services Report (SQL 2000)
If I build it in VB6, it will work with ASP, but RS gives me the error
"...dll does not contain an assembly"
If I build it in VB.NET, it will work with RS, but ASP gives the error
"can't create activeX component". It WILL work with an ASP.NET page,
but ideally I do not want to rewrite my entire ASP site for .NET just
to make this work.
All that being said, is there any way to write a DLL that will work
for both?
Thanks in advance,
EricNo, there is not. At least not exactly. What you can do is create your
assembly and then create a wrapper for it for your ASP application.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<c-eric.geil@.mci.com> wrote in message
news:4bb9bbd8-5047-4827-9212-e2a47fde8593@.72g2000hsu.googlegroups.com...
> I'm trying to create a DLL that I can use with:
> A) an ASP ("classic" ASP, not .NET)
> B) a Reporting Services Report (SQL 2000)
> If I build it in VB6, it will work with ASP, but RS gives me the error
> "...dll does not contain an assembly"
> If I build it in VB.NET, it will work with RS, but ASP gives the error
> "can't create activeX component". It WILL work with an ASP.NET page,
> but ideally I do not want to rewrite my entire ASP site for .NET just
> to make this work.
> All that being said, is there any way to write a DLL that will work
> for both?
> Thanks in advance,
> Eric|||Can you post an example of this?|||I have not had to do it. I just know it is possible. Especially if
non-visual. Gooble: com interop dotnet vb6
or Google: dotnet dll wrapper
The second search returned lots of good links.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<c-eric.geil@.mci.com> wrote in message
news:3c85e1da-f197-4907-9c6d-d509cca2216a@.i12g2000prf.googlegroups.com...
> Can you post an example of this?

Custom Assembly in RDL - Need Solution - Very Urgent

Hi All,
I have a Custom .net dll, refered in the RDL, the dll has a function which
gets the encrypted CreditCard# and returns the Decrypted value to the
Report.
I have attached the code @. the end.
I have given created the permission set and code group and copied the dll
in the following location
C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\
bin\
Now when I run the report I am getting the Credit Card# decrypted shown in
the Preview window of Report Designer.....
But when I deploy the report in my report server I am getting #Error in the
CC# field.
I followed the step in the (http://support.microsoft.com/?
kbid=842419#XSLTH3133121123120121120120) to-grant permissions to a custom
assembly that is referenced in a report in Reporting Services
But there are four steps
1. Assert permissions in your custom assembly.
2. Make the custom assembly available to Report Designer and to Report
Server.
3. Reference the custom assembly in your report.
4. Modify the code access security settings for your custom assembly.
I am not sure with the STEP -1 WHAT ASSET PERMISSION IN CUSTOM ASSEMBLY TO
ADD FOR THE CRPTOGRAPY...because in the link I can see for the textfile and
SQLClinet...
I need your help on this...
Thanks in advance
Balaji.
using System;
using System.Text;
using System.IO;
using System.Collections.Specialized;
using System.Configuration;
using System.Security.Cryptography;
using FCLX509 = System.Security.Cryptography.X509Certificates;
using WSEX509 = Microsoft.Web.Services2.Security.X509;
using WSECRY = Microsoft.Web.Services2.Security.Cryptography;
namespace RDLCustomCode
{
/// <summary>
/// This class is responsible for the data decryption of the
/// user credit card information
/// </summary>
public class DataDecryptionClass
{
public DataDecryptionClass()
{
}
public static string DecryptCardInfo(string cc,string subjectName,string
storeName)
{
string sCreditCard = "";
try
{
FileStream file = new FileStream("C:\\path.txt", FileMode.OpenOrCreate,
FileAccess.Write);
StreamWriter sw = new StreamWriter(file);
WSEX509.X509CertificateStore.StoreLocation location = WSEX509.X509CertificateStore.StoreLocation.CurrentUser;
WSEX509.X509CertificateStore.StoreProvider provider = WSEX509.X509CertificateStore.StoreProvider.System;
WSEX509.X509CertificateStore store = new WSEX509.X509CertificateStore
(provider, location, storeName);
bool fopen = store.OpenRead();
if(fopen)
{
WSEX509.X509CertificateCollection certs = store.FindCertificateBySubjectString(subjectName);
if (certs.Count > 0)
{
WSEX509.X509Certificate cer = certs[0];
WSECRY.RSACryptoServiceProvider rsaCsp = (WSECRY.RSACryptoServiceProvider)cer.Key;
byte[] cipherData = Convert.FromBase64String(cc);
byte[] plainData = rsaCsp.Decrypt(cipherData, false);
sCreditCard = Encoding.UTF8.GetString(plainData);
sw.Write(sCreditCard);
}
}
sw.Close();
file.Close();
if (store != null)
store.Close();
return sCreditCard;
//return cc;
}
catch
{
return "ErrorHandling";
}
}
--
Message posted via http://www.sqlmonster.comDid you get an error ? WHat is the error ? Did you see a .NET stack trace ?
Did you try to put the Assembly in the GAC ? There you check wheter if it is
a permission problem.
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"BALAJI KRISHNAN via SQLMonster.com" <forum@.nospam.SQLMonster.com> schrieb
im Newsbeitrag news:22c746269e61489188230bc4b59e35df@.SQLMonster.com...
> Hi All,
> I have a Custom .net dll, refered in the RDL, the dll has a function which
> gets the encrypted CreditCard# and returns the Decrypted value to the
> Report.
> I have attached the code @. the end.
> I have given created the permission set and code group and copied the dll
> in the following location
> C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\
> C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> Services\ReportServer\
> bin\
> Now when I run the report I am getting the Credit Card# decrypted shown in
> the Preview window of Report Designer.....
> But when I deploy the report in my report server I am getting #Error in
> the
> CC# field.
> I followed the step in the (http://support.microsoft.com/?
> kbid=842419#XSLTH3133121123120121120120) to-grant permissions to a custom
> assembly that is referenced in a report in Reporting Services
> But there are four steps
> 1. Assert permissions in your custom assembly.
> 2. Make the custom assembly available to Report Designer and to Report
> Server.
> 3. Reference the custom assembly in your report.
> 4. Modify the code access security settings for your custom assembly.
>
> I am not sure with the STEP -1 WHAT ASSET PERMISSION IN CUSTOM ASSEMBLY TO
> ADD FOR THE CRPTOGRAPY...because in the link I can see for the textfile
> and
> SQLClinet...
> I need your help on this...
> Thanks in advance
> Balaji.
>
> using System;
> using System.Text;
> using System.IO;
> using System.Collections.Specialized;
> using System.Configuration;
> using System.Security.Cryptography;
> using FCLX509 = System.Security.Cryptography.X509Certificates;
> using WSEX509 = Microsoft.Web.Services2.Security.X509;
> using WSECRY = Microsoft.Web.Services2.Security.Cryptography;
> namespace RDLCustomCode
> {
> /// <summary>
> /// This class is responsible for the data decryption of the
> /// user credit card information
> /// </summary>
> public class DataDecryptionClass
> {
> public DataDecryptionClass()
> {
> }
> public static string DecryptCardInfo(string cc,string subjectName,string
> storeName)
> {
> string sCreditCard = "";
> try
> {
> FileStream file = new FileStream("C:\\path.txt", FileMode.OpenOrCreate,
> FileAccess.Write);
> StreamWriter sw = new StreamWriter(file);
>
> WSEX509.X509CertificateStore.StoreLocation location => WSEX509.X509CertificateStore.StoreLocation.CurrentUser;
> WSEX509.X509CertificateStore.StoreProvider provider => WSEX509.X509CertificateStore.StoreProvider.System;
> WSEX509.X509CertificateStore store = new WSEX509.X509CertificateStore
> (provider, location, storeName);
> bool fopen = store.OpenRead();
> if(fopen)
> {
> WSEX509.X509CertificateCollection certs => store.FindCertificateBySubjectString(subjectName);
> if (certs.Count > 0)
> {
> WSEX509.X509Certificate cer = certs[0];
> WSECRY.RSACryptoServiceProvider rsaCsp => (WSECRY.RSACryptoServiceProvider)cer.Key;
> byte[] cipherData = Convert.FromBase64String(cc);
> byte[] plainData = rsaCsp.Decrypt(cipherData, false);
> sCreditCard = Encoding.UTF8.GetString(plainData);
> sw.Write(sCreditCard);
>
> }
> }
> sw.Close();
> file.Close();
> if (store != null)
> store.Close();
> return sCreditCard;
> //return cc;
> }
> catch
> {
> return "ErrorHandling";
> }
>
> }
> --
> Message posted via http://www.sqlmonster.com|||I ve solved similar problem a day before. See this...
Problem is: You dont ve File Permission for your assembly (dll).
Solution:
Step1: Change rrsvpolicy.config with following snippet added-
<PermissionSet
class="NamedPermissionSet"
version="1"
Name="HelloFilePermissionSet"
Description="A special permission set that grants read access to my
hello file.">
<IPermission
class="FileIOPermission"
version="1"
PathDiscovery="C:\inetpub\mailroot"
/>
<IPermission
class="SecurityPermission"
version="1"
Flags="Execution, Assertion"
/>
</PermissionSet>
Step 2: Change Dll with the following code added on class-
[FileIOPermissionAttribute(SecurityAction.Assert,
PathDiscovery="c:\\inetpub\\mailroot\\")]
public class MailSystem
{
public MailSystem()
{
}
............//rest of class.
Step 3: Change Dll with the following code added in Assemblyinfo.cs-
[assembly:AllowPartiallyTrustedCallers]
Note: Please add appropriate namespaces.
:o) It works for sure. and if this doesnt work.. mail
me(suneetmohan@.gmail.com). i'll mail ya complete code.