Showing posts with label components. Show all posts
Showing posts with label components. Show all posts

Thursday, March 22, 2012

accessing components and task from scripting task

Hi, I have to researching of how to accesss package tasks and component using the SqlServer.Dts.Runtime class and so far, I havent found any solution. For example, if you package has a scriptiong task and a data flow task(<- which contains a data source component). Is it possible to use the scripting component to access the data source component in the data flow task and manipulate its properites like sqlcommand etc.

Emmanuel

An easier and more direct way to do this is to store the sqlcommand for the datasource in a package variable and set the variable value in the script task or even at the time of executing the package.

|||I know that can be done using variables and expressions and all that but i want to know where its possible to access component and dask of a package in a scripting task using a SqlServer.Runtime library. I know you can pass variable around be I want to know how to control component properties in a scripting task or component if possible. If anyone know how to do that or can direct me to the right resource, I will be glad. Thanks.|||Nope, the tasks and components can't directly access each other at runtime.

Monday, March 19, 2012

Access Violation What does it mean?

My web app (with SSL for every page) that uses VBCOM+ components to access
SQLServer2000 SP3 via SPs had an access violation the other day when two
users were simultaneously looking at the precisely the same information on
the same customer (one was training the other using two machines and going
through each step synchronously) and I received the Access violation error
(below). This has not happened before in two years (but no one probably
every came close to simulaneous use) and these two folks were the ONLY ones
who were even using the db and what they attempted to do (a data view) works
fine after this happened. There is nothing in the SQL Server error log about
this or are there any .dmp files in LOG. I saw an old FIX re: Access
violation during SSL but I'm at SP3 already, although this clearly wasn't an
exception error.
After Googling the web, I'm not even sure what "access violation" means,
although it sounds like it has nothing to do with my T-SQL code and is more
serious.
So, what does this mean?
Thanks.
Source: Microsoft OLE DB Provider for SQL Server
Error Number: -2147217900
Description: Syntax error or access violationAn AV is generally a bug in SQL Server... Look for the error message on MS
web site (using the long number that comes with the AV), and/or open a call
to MS... IF you are identifying a bug there will be no service charge.
"Don Miller" <nospam@.nospam.com> wrote in message
news:efbjxkyQDHA.2832@.TK2MSFTNGP10.phx.gbl...
> My web app (with SSL for every page) that uses VBCOM+ components to access
> SQLServer2000 SP3 via SPs had an access violation the other day when two
> users were simultaneously looking at the precisely the same information on
> the same customer (one was training the other using two machines and going
> through each step synchronously) and I received the Access violation error
> (below). This has not happened before in two years (but no one probably
> every came close to simulaneous use) and these two folks were the ONLY
ones
> who were even using the db and what they attempted to do (a data view)
works
> fine after this happened. There is nothing in the SQL Server error log
about
> this or are there any .dmp files in LOG. I saw an old FIX re: Access
> violation during SSL but I'm at SP3 already, although this clearly wasn't
an
> exception error.
> After Googling the web, I'm not even sure what "access violation" means,
> although it sounds like it has nothing to do with my T-SQL code and is
more
> serious.
> So, what does this mean?
> Thanks.
> Source: Microsoft OLE DB Provider for SQL Server
> Error Number: -2147217900
> Description: Syntax error or access violation
>
>

Thursday, February 9, 2012

Access denied to files

Hi,

Im trying to "use" files during my flow in two diferent kind of components (send email task and custom transformation), but the error i get is similar: access denied, file doesnt exists, is locked by another proccess or not enough rigths.

-In custom transofrmation i am trying to write to a file with the next code:

Dim sw As StreamWriter

If (Not File.Exists(".\test.txt")) Then

sw = File.CreateText(".\test.txt")

Else

sw = File.AppendText(".\test.txt")

End If

sw.Write("Numero de Registros en Empresas")

sw.WriteLine(Row.CuentaRegEmpresas)

sw.Write("Numero de Registros en Reporta")

sw.WriteLine(Row.CuentaRegReporta)

sw.Write("Numero de Registros de Facturas ampliadas")

sw.WriteLine(Row.CuentaRegFAmp)

sw.WriteLine()

- In send email tranformation i am trying to attach a different file (the log of the process) , but the error is that i dont have rights to access. If i try to send another file this error disappears...

Both files (test.txt and log.txt) have total control rights to all users, and arent locked or opened by any other process during the execution.

Edit: Thats the error trace i get:

en System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

en System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)

en System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)

en System.IO.StreamWriter.CreateFile(String path, Boolean append)

en System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)

en System.IO.StreamWriter..ctor(String path, Boolean append)

en System.IO.File.AppendText(String path)

en ScriptComponent_14cd101f436a42b18dc68087869033b2.ScriptMain.Entrada0_ProcessInputRow(Entrada0Buffer Row)

en ScriptComponent_14cd101f436a42b18dc68087869033b2.UserComponent.Entrada0_ProcessInput(Entrada0Buffer Buffer)

en ScriptComponent_14cd101f436a42b18dc68087869033b2.UserComponent.ProcessInput(Int32 InputID, PipelineBuffer Buffer)

en Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)

You mention three different errors, can you be clear about which error happens when? Please post the exact error message as well.

Can you also explain more about the tasks, and the order they are executed within your package.

The code snippet above seems incomplete, and also rather strang, perhaps if you posted the full code it would make more sense. Based on what you have posted I'd say it is wrong, as opening the file for each row is a bad idea, and you do not close the file.

As an aside the syntax seems complicated, to append to a file, just use the constructor overload -

Code Snippet

StreamWriter stream = new StreamWriter("C:\Test.txt", true);

stream.WriteLine("Test");

stream.Close();

|||

Hi Darren,

Your are right, the problem of the custom transformation was that i did not close the StreamWriter, now it's working fine.

The other problem is that, at the end of the process i want to send the log file, but it seems like the process locks the file and cant be attached in the email... am i wrong? i will try to send the email in other package inside the same project... Its possible to send parameters to the new package?

Any other idea to send the log via email just at the end of the process?

Thanks

Edit: I have proved this solution and it doesnt work... log file cant be send using a different package inside the project.

|||Why is the file locked? If you are in control of writing the file, then you should have closed and therefore released all locks to the file, so the file should be available to send. You must have something open still. Ultimately you can use something like Process Moniotor of File? (I forget to find who has the lock), the old SysInternals tools, now MS.|||The file that is locked is the log of the process... i have read in other post that is not possible to send it becuase the own process locks it, so i decide to send via email only the errors stored in @.[System::ErrorDescription]

variable when an error event is raised.

thanks