Showing posts with label books. Show all posts
Showing posts with label books. Show all posts

Wednesday, March 21, 2012

Problem with source from Books Online - Application.LoadPackage

I'm trying to execute a package in the file system from an c# assembly. In BOL there is the following sample code available:

ms-help://MS.VSCC.v80/MS.VSIPCC.v80/MS.SQLSVR.v9.en/dtsref9mref/html/M_Microsoft_SqlServer_Dts_Runtime_Application_LoadPackage_1_cfc592c3.htm

Application.LoadPackage Method (String, IDTSEvents)




class ApplicationTests
{
static void Main(string[] args)
{
// The variable pkg points to the location of the
// ExecuteProcess package sample installed with
// the SSIS samples.
string pkg = @."C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";

Application app = new Application();
Package p = app.LoadPackage(pkg, null);
// Now that the package is loaded, we can query on
// its properties.
int n = p.Configurations.Count;
DtsProperty p2 = p.Properties["VersionGUID"];
DTSProtectionLevel pl = p.ProtectionLevel;

Console.WriteLine("Number of configurations = " + n);
Console.WriteLine("VersionGUID = " + p2);
Console.WriteLine("ProtectionLevel = " + pl);
}
}

I added the reference to "Microsoft.SQLServer.DTSRuntimeWrap" and declared it by


using Microsoft.SqlServer.Dts.Runtime.Wrapper;

No I'm not able to compile because app.LoadPackage(pkg, null); needs an additional IDTSEvents90. After changing the row to


Package p = app.LoadPackage(pkg, true, null);

I'm getting the following errors:

Error 1 Cannot implicitly convert type 'Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSPackage90' to 'Microsoft.SqlServer.Dts.Runtime.Wrapper.Package'. An explicit conversion exists (are you missing a cast?)

Error 2 The type or namespace name 'DtsProperty' could not be found (are you missing a using directive or an assembly reference?)

Error 3 'Microsoft.SqlServer.Dts.Runtime.Wrapper.Package' does not contain a definition for 'Properties'

Can someone please give me an example how to start the Package now in the latest code syntax and set the values of a variable from outside?

I am using the following versions

Microsoft Visual Studio 2005
Version 8.0.50727.26 (RTM.050727-2600)
Microsoft .NET Framework
Version 2.0.50727

SQL Server Integration Services
Microsoft SQL Server Integration Services Designer
Version 9.00.1314.00

Best regards,
Dirk

Add a reference to Microsoft.SqlServer.ManagedDts.dll and use namespace Microsoft.SqlServer.Dts.Runtime (without .Wrapper).

.Wrapper assembly and namespace contain COM interop declarations - i.e. if you want to work with unmanaged object model directly. It is usually more convinient to work with managed object model built on top of it.sql

Saturday, February 25, 2012

Problem with Performances

Hallo everbody,
I'm having a serious problem with my aspx pages. Ideveloped few pages that allow users to retrieve books information froma database (MS SQL). The database table contains about 5000 records.
My queries are very simple, nevertheless the time necessary to perform them is extremely long.
I tried to set the time out of the data adapter to 0 and I removed thedebug mode (debug="true") from the web.config file. I'm still not ableto perform a query.
What is wrong with it? Is it something related with the database?

Any help is appreciated...

Thanks,

christianIt does not seem to be a database issue. You can execute the query in Query Analyzer(SQL2000)/Management Studio(SQL2005) and see how long will it take to complete. However would you show me the query statement and your table schema?|||This si the query:
SELECT *
FROM DocTable1 WHERE FREETEXT("column name",column value)
(very simple)

The table is

CREATE TABLE [DocTable1] (
[DocNumber] [int] NOT NULL ,
[LastName] [varchar] (50) ,
[FirstName] [varchar] (50) ,
[Program] [varchar] (50) ,
[Paper] [varchar] (50) ,
[Location] [varchar] (50) ,
[ANNO] [int] NULL ,
[Title] [ntext] ,
[TitleSort] [ntext] ,
[Keywords] [ntext] ,
[FT] [char] (1) ,
[URL] [varchar] (250) ,
CONSTRAINT [PK_DocTable1] PRIMARY KEY CLUSTERED
(
[DocNumber]
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO|||

When FREETEXT is used, the full-text query engine internally "word-breaks" thefreetext_stringinto a number of search terms and assigns each term a weight and then finds the matches. So it can cause poor performance if the searched column contains a large text. You can create full-text indexes on the table to speed up full-text query: To enable a database for full-text indexing:
1. Expand a server group, and then expand a server.
2. Expand Databases, and then click a database to enable.
3. On the Tools menu, click Full-Text Indexing.
4. Complete the Full-Text Indexing Wizard.

Search full-text indexes in SQL2000 Books Online you'll find lots of articles.

|||Thanks for your suggestion, but I have already done that.
The problem is the CLR debugger. I'm using just the debugger, I do not have Visual Studio.
In order to use the debugger you have to change the we.config file,adding a line debug="true" which set the asp.net framework to work indebug mode. This slowed down incredibly the performances of the entirewebsite. I removed the debugger, I delete the line debug="true" in theweb.config file and the site went back tyo work perfectly.

christian|||Good news:) I've learned much from you. Thanks!