Showing posts with label component. Show all posts
Showing posts with label component. Show all posts

Friday, March 30, 2012

No loading data from ScriptComponent.

Dear all,

I've created a Data Flow scenario as follow:

At first I've got a Flat File Source and then Script Component Task and then OleDb Destination, linked among them by arrows, of course. When I run the SSIS all of them is successfully executed except the last task. Why? I don't know but it isn't awared of nothing.

649 rows are passed to Script Component from the file but they aren't going to my Sql table.

Let me know any advice or thought regarding ths.

Thanks a lot,

We need far far more information than you have provided here.

Is it a synchronous or asynchronous compoennt?|||

Hi Jamie,

Thanks for your quick response.

You'll see the full contains for the .net script

Public Class ScriptMain

Inherits UserComponent

Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

Dim valorColumna As String

valorColumna = Row.Column9.Substring(1, 1)

If valorColumna = "N" Then

Me.Output0Buffer.IMPBASE = -1 * CDbl(Row.Column10 / 100)

Else

Me.Output0Buffer.IMPBASE = CDbl(Row.Column10 / 100)

End If

Me.Output0Buffer.PORCRETEN = CDbl(Row.Column11 / 100)

Me.Output0Buffer.IMPRETEN = CDbl(Row.Column12 / 100)

Me.Output0Buffer.EJERCICIO = CInt(Row.Column2)

Me.Output0Buffer.CODPROV = CInt(Row.Column7)

Me.Output0Buffer.MODALIDAD = CInt(Row.Column8)

Me.Output0Buffer.NIFPERC = CStr(Row.Column3)

Me.Output0Buffer.NIFREP = CStr(Row.Column4)

Me.Output0Buffer.NOMBRE = CStr(Row.Column6)

Me.Output0Buffer.EJERDEV = CDbl(Row.Column13)

End Sub

I haven't idea if it's asyn or syn

I think that there is some big error very very stupid in all of this.

Thanks again,

Enric

Friday, March 23, 2012

No cubes can be found error

In the data panel of the report designer component, every time I try to create or modify an MDX statement, I'm now getting a "No cubes can be found. (Microsoft.AnalysisServices.Controls)" error. Works fine on the Layout and Preview tabs. Just all of a sudden appeared. Working fine against relational sources. As a warning to all, Reporting Services and Analysis Services is definitely not a marriage made in heaven. Proceed with caution.I'm going to have to learn to delete my profile everytime something strange happens with SQL 2005. Somehow, my profile on my primary development machine was corrupted again.

No column was specified to allow the component to advance through the file.

Hello,

I apologize in advance if this seems like a relative easy answer, however, I can't find it anywhere, and I can't figure it out personally, I am relatively new to SSIS and C#.

I am attempting to write in C# a simple program, where I am taking a table from an OLE DB Source and transfering it to a comma delimited flat file.

I have been trying to work through samples and other methods of help, but I continue to get stuck, and this is my latest problem.

When trying to excecute I get the error: No column was sepcified to allow the component to advance through the file, for my flat file destination.

I know what this means, I just do not know how to fix it.

Below is my code so far. I highly doubt my code is the best it can get for this type of example, so if you see anything that I do not need in the code for it to perform what I want it to perform, please let me know.

(The code to excecute this package is in a different file).

using System;

using Microsoft.SqlServer.Dts.Runtime;

using Microsoft.SqlServer.Dts.Pipeline;

using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

namespace Microsoft.SqlServer.Dts.Samples

{

class Program

{

static void Main(string[] args)

{

// Create a package and add a Data Flow task.

Package package = new Package();

Executable e = package.Executables.Add("DTS.Pipeline.1");

TaskHost thMainPipe = e as TaskHost;

MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe;

// Create Application

Application app = new Application();

// Add an OLE DB connection manager to the package.

ConnectionManager conMgr = package.Connections.Add("OLEDB");

conMgr.ConnectionString = "Data Source=ROSIE\\ROSIE2005;" +

"Initial Catalog=AdventureWorks;Provider=SQLNCLI;" +

"Integrated Security=SSPI;Auto Translate=false;";

conMgr.Name = "SSIS Connection Manager for OLE DB";

conMgr.Description = "OLE DB connection to the " +

"AdventureWorks database.";

// Create and configure an OLE DB source component.

IDTSComponentMetaData90 source =

dataFlowTask.ComponentMetaDataCollection.New();

source.ComponentClassID = "DTSAdapter.OLEDBSource.1";

// Create the design-time instance of the source.

CManagedComponentWrapper srcDesignTime = source.Instantiate();

// The ProvideComponentProperties method creates a default output.

srcDesignTime.ProvideComponentProperties();

// Assign the connection manager.

source.RuntimeConnectionCollection[0].ConnectionManager =

DtsConvert.ToConnectionManager90(conMgr);

// Set the custom properties of the source.

srcDesignTime.SetComponentProperty("AccessMode", 2);

srcDesignTime.SetComponentProperty("SqlCommand",

"Select * from HumanResources.EmployeePayHistory");

srcDesignTime.SetComponentProperty("OpenRowset", "[AdventureWorks].[HumanResources].[EmployeePayHistory");

// Need to set the ConnectionManagerID

if (source.RuntimeConnectionCollection.Count > 0)

{

source.RuntimeConnectionCollection[0].ConnectionManagerID =

conMgr.ID;

source.RuntimeConnectionCollection[0].ConnectionManager =

DtsConvert.ToConnectionManager90(conMgr);

}

// Connect to the data source,

// and then update the metadata for the source.

srcDesignTime.AcquireConnections(null);

srcDesignTime.ReinitializeMetaData();

srcDesignTime.ReleaseConnections();

// Add an flat file source connection manager to the package.

ConnectionManager conMgr2 = package.Connections.Add("FlatFile");

conMgr2.ConnectionString = "C:\\Documents and Settings\\ddoorn" +

"\\My Documents\\Visual Studio 2005\\Projects\\" +

"DennisSampleProgram1\\EmployeePayHistory.txt";

conMgr2.Name = "SSIS Connection Manager for Flat File";

conMgr2.Description = "Flat File Destination Connection";

// Create Destination Component

IDTSComponentMetaData90 destination =

dataFlowTask.ComponentMetaDataCollection.New();

destination.Name = "Flat File Destination";

destination.ComponentClassID =

"DTSAdapter.FlatFileDestination.1";

CManagedComponentWrapper destDesignTime = destination.Instantiate();

destDesignTime.ProvideComponentProperties();

// Assign the connection manager.

destination.RuntimeConnectionCollection[0].ConnectionManager =

DtsConvert.ToConnectionManager90(conMgr2);

// Set Custom Properties

destDesignTime.SetComponentProperty("Overwrite", true);

// Assignment an ID to the ConnectionManager

if (destination.RuntimeConnectionCollection.Count > 0)

{

destination.RuntimeConnectionCollection[0].ConnectionManagerID =

conMgr2.ID;

destination.RuntimeConnectionCollection[0].ConnectionManager =

DtsConvert.ToConnectionManager90(conMgr2);

}

// Create the path from source to destination.

IDTSPath90 path = dataFlowTask.PathCollection.New();

path.AttachPathAndPropagateNotifications(source.OutputCollection[0],

destination.InputCollection[0]);

// Get the destination's default input and virtual input.

IDTSInput90 input = destination.InputCollection[0];

IDTSVirtualInput90 vInput = input.GetVirtualInput();

// Iterate through the virtual input column collection.

foreach (IDTSVirtualInputColumn90 vColumn

in vInput.VirtualInputColumnCollection)

{

// Call the SetUsageType method of the destination

// to add each available virtual input column as an input column.

destDesignTime.SetUsageType(

input.ID, vInput, vColumn.LineageID,

DTSUsageType.UT_READONLY);

}

//map external metadata to the inputcolumn

//int index = 0;

foreach (IDTSInputColumn90 inputColumn in input.InputColumnCollection)

{

IDTSExternalMetadataColumn90 exMetaColumn =

input.ExternalMetadataColumnCollection.New();

//(IDTSExternalMetadataColumn90)input.ExternalMetadataColumnCollection[index++];

exMetaColumn.CodePage = inputColumn.CodePage;

exMetaColumn.DataType = inputColumn.DataType;

exMetaColumn.Length = inputColumn.Length;

exMetaColumn.Name = inputColumn.Name;

inputColumn.ExternalMetadataColumnID = exMetaColumn.ID;

destDesignTime.MapInputColumn(input.ID, inputColumn.ID, exMetaColumn.ID);

}

// Verify that the columns have been added to the input.

// This is only really required for debugging purposes

Console.WriteLine("Below are the columns that have been added " +

"to the input. Press Enter to Verify");

foreach (IDTSInputColumn90 inputColumn in

destination.InputCollection[0].InputColumnCollection)

{

Console.WriteLine(inputColumn.Name);

}

Console.Read();

// Connect to the data source,

// and then update the metadata for the source.

destDesignTime.AcquireConnections(null);

destDesignTime.ReinitializeMetaData();

destDesignTime.ReleaseConnections();

// Save Package to XML

app.SaveToXml("C:\\Documents and Settings\\ddoorn\\My Documents\\" +

"Visual Studio 2005\\Projects\\DennisSampleProgram1\\" +

"DennisSampleProgram1\\DennisSampleProject1.xml",

package, null);

} // main

} // program

} // namespace

Nevermind, I found an example that comes with SQL Server 2005/Visual Studio and I found my mistake.