Script Task examples
Hi Experts
I'm reading SSIS book to learn SSIS. My background is also programming but never work with VB and C. In SSIS book there is a topic of Script Task and in this topic the author uses Script Task and use VB but it is so confusing but if somebody help me out
to give some example for Script Task that is commonly use then I really thankful to him.. Thanks in advance.
Regards
Muz
some example for Script Task that is commonly use then I really thankful to him..
Hello Muz,
Every ETL process is very individual (by my experiences) so it will be difficult to find a "commonly" used script example.
Olaf Helper
[ Blog] [ Xing] [ MVP]
Similar Messages
-
Script task fails to send mail to GMAIL
Hi guys ,
I am new here and i am glad i that i am here. I am working in a company as SQL Server developer(T-sql), i am learning SSIS because i wanted to move to data warehousing.
I not familiar and i don't know any thing about C#, but i am learning SSIS on my own.
I tried to send mail to gmail using script task , both sender and receiver with same mail ID using variables which i tried using tutorial i found from the below link.
[quote]http://www.codeproject.com/Articles/85172/Send-Email-from-SSIS-with-option-to-indicate-Email[/quote]
but finally when i execute the task , it returns failure message and email is not sent.
[quote]SSIS package "Send mail using script task.dtsx" starting.
Error: 0x8 at Script Task: The script returned a failure result.
Task failed: Script Task
SSIS package "Send mail using script task.dtsx" finished: Success.
[/quote]
Below message taken from progress tab
[quote]Error: The script returned a failure result.[/quote]
Can you all please help me in finding where i am going wrong? please check below code which i have used in script task.
Microsoft SQL Server Integration Services Script Task
Write scripts using Microsoft Visual C# 2008.
The ScriptMain is the entry point class of the script.
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Net.Mail;
namespace ST_9bc84810a62a401aa44ddd905bcd369d.csproj
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#region VSTA generated code
enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
#endregion
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.
To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
To open Help, press F1.
public void Main()
string sSubject = "Test Subject";
string sBody = "Test Message";
int iPriority = 2;
if (SendMail(sSubject, sBody, iPriority))
Dts.TaskResult = (int)ScriptResults.Success;
else
//Fails the Task
Dts.TaskResult = (int)ScriptResults.Failure;
public bool SendMail(string sSubject, string sMessage, int iPriority)
try
string sEmailServer = Dts.Variables["sEmailServer"].Value.ToString();
string sEmailPort = Dts.Variables["sEmailPort"].Value.ToString();
string sEmailUser = Dts.Variables["sEmailUser"].Value.ToString();
string sEmailPassword = Dts.Variables["sEmailPassword"].Value.ToString();
string sEmailSendTo = Dts.Variables["sEmailSendTo"].Value.ToString();
string sEmailSendCC = Dts.Variables["sEmailSendCC"].Value.ToString();
string sEmailSendFrom = Dts.Variables["sEmailSendFrom"].Value.ToString();
string sEmailSendFromName = Dts.Variables["sEmailSendFromName"].Value.ToString();
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress(sEmailSendFrom, sEmailSendFromName);
//You can have multiple emails separated by ;
string[] sEmailTo = Regex.Split(sEmailSendTo, ";");
string[] sEmailCC = Regex.Split(sEmailSendCC, ";");
int sEmailServerSMTP = int.Parse(sEmailPort);
smtpClient.Host = sEmailServer;
smtpClient.Port = sEmailServerSMTP;
System.Net.NetworkCredential myCredentials =
new System.Net.NetworkCredential(sEmailUser, sEmailPassword);
smtpClient.Credentials = myCredentials;
message.From = fromAddress;
if (sEmailTo != null)
for (int i = 0; i < sEmailTo.Length; ++i)
if (sEmailTo[i] != null && sEmailTo[i] != "")
message.To.Add(sEmailTo[i]);
if (sEmailCC != null)
for (int i = 0; i < sEmailCC.Length; ++i)
if (sEmailCC[i] != null && sEmailCC[i] != "")
message.To.Add(sEmailCC[i]);
switch (iPriority)
case 1:
message.Priority = MailPriority.High;
break;
case 3:
message.Priority = MailPriority.Low;
break;
default:
message.Priority = MailPriority.Normal;
break;
//You can enable this for Attachments.
//SingleFile is a string variable for the file path.
//foreach (string SingleFile in myFiles)
// Attachment myAttachment = new Attachment(SingleFile);
// message.Attachments.Add(myAttachment);
message.Subject = sSubject;
message.IsBodyHtml = true;
message.Body = sMessage;
smtpClient.Send(message);
return true;
catch (Exception ex)
return false;
Please help me resolve this guys ... THANKS IN ADVANCEThank you very much for your reply @Elvis Long,
Sorry for the late reply
Actually, i am not trying or executing this task from my office , but i am trying this at my home :( .
sEmailPort has value 587 sEmailServer has smtp.gmail.com
Can you please check whether this C# coding is correct or not ? because finally it gives error saying "Script
Task: The script returned a failure result"
so can you please check this with your system and let me know what is wrong with this code
Thanks in advance -
SSIS PACKAGE MIGRATION FROM 2005 to 2008 - Script task/component errors
HI All,
We have to migrate ssis packages (about 300) from ssis 2005 to 2008 .
1. I understand that the major concern is regarding the script component/tasks.
I searched a lot about this and also consulted with many friends , all of them are aware of this issue but not able to provide what could be the issues and the solution.
Can some one help me with the common script issues that can happen during migration and the solution for the same.
2. I do have one more question.
As per my understanding given in the below link
http://blogs.msdn.com/b/mattm/archive/2008/03/21/package-upgrade-wizard.aspx
there is this part which says ...
Once the packages have been chosen, the next page asks you to pick the output location. This can be:
Same as the source location
File System
SSIS Service (Package Store)
SQL Server
Does this mean I can deploy in sql server directly on fly while upgrading ?
Any help highly appreciated .
Regards
Praveen..Hi Praveen,
Question 1: The error may occur if there are duplicate input columns in the Script Task/Component or the current user cannot access the C:\Windows\Temp directory. Except for the link provided by SanBhaumik, you can also refer to the following
threads:
http://www.sqlservercentral.com/Forums/Topic811208-148-1.aspx
http://social.technet.microsoft.com/Forums/sqlserver/en-US/5c11eb57-59d6-4f81-bfdc-13bd6489a0ac/sql-server-2008-ssis-package-script-component-error?forum=sqlintegrationservices
Question 2: We can directly save the package to the File System, SSIS Package Store, or SQL Server by selecting the proper destination during the package upgrade. However, this operation is not equal to the package install operation identically.
For example, if we have enabled package configurations for a package, the package configurations won’t be upgraded or installed during the package upgrade.
Regards,
Mike Yin
TechNet Community Support -
Calling a restful web service from a script task
Hi. I'm weak in c# but am looking to accomplish this...
I want to call a RESTful web service from an ssis script task. I don't want to create a web service so I'm hoping there is some publicly available one I can practice with before our web team provides me with the service I'll eventually use. Can
the community provide an example? I wish I had more but my knowledge is very limited except for using ssis in more sql centric apps. It would be great if I could exercise both a get and put verb but I understand i'll be lucky if I can even get
a get to work.
Here is an example of a get I found on the web but I don't know if its a viable candidate for me to practice with from my package...
using System;
using System.IO;
using System.Net;
using System.Text;
// Create the web request
HttpWebRequest request = WebRequest.Create("http://developer.yahoo.com/") as HttpWebRequest;
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
// Console application output
Console.WriteLine(reader.ReadToEnd());
and in the same article an example of a put ...
// We use the HttpUtility class from the System.Web namespace
using System.Web;
Uri address = new Uri("http://api.search.yahoo.com/ContentAnalysisService/V1/termExtraction");
// Create the web request
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
// Set type to POST
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
// Create the data we want to send
string appId = "YahooDemo";
string context = "Italian sculptors and painters of the renaissance"
+ "favored the Virgin Mary for inspiration";
string query = "madonna";
StringBuilder data = new StringBuilder();
data.Append("appid=" + HttpUtility.UrlEncode(appId));
data.Append("&context=" + HttpUtility.UrlEncode(context));
data.Append("&query=" + HttpUtility.UrlEncode(query));
// Create a byte array of the data we want to send
byte[] byteData = UTF8Encoding.UTF8.GetBytes(data.ToString());
// Set the content length in the request headers
request.ContentLength = byteData.Length;
// Write data
using (Stream postStream = request.GetRequestStream())
postStream.Write(byteData, 0, byteData.Length);
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
// Console application output
Console.WriteLine(reader.ReadToEnd());
Hi
db042190,
These kinds of operations are commonly found outside the SSIS section of the forum, you just need to "borrow" the code and wrap into the Script Task. And based on what you see you are on the right tracks.
One thing you need to be aware of: in production such RESTfull call usually lead to a fiasco for the machine residing in some kind of DMZ or Firewall rules prohibiting these methods or you need a proxy account to run the package and you face unbeggable admins
who resist to relaxing security.
My suggestion is to go the easy route: write the app up as a console, standalone app - it will be easier to debug and there will be complete examples of them in abundance on the web.
Arthur
MyBlog
Twitter -
Output from script task to cmd prompt
Hi,
I have a SISS package that has script task in it.
I'm exeuting the package in the command prompt using the following command.
DTEXEC.EXE /F "C:\Documents and Settings\Devuser\Desktop\Deployment\Package.dtsx" /set \package.variables[filepath].Value;"C:\\Documents and Settings\\Devuser\\Desktop\\Release-Deployment\\release\\"
It is sucessfully executed and the following is displayed in the command prompt screen.
DTExec : The package execution returned DTDER_SUCESS <0>
However, i would like to show cusom message. Is it possible to show custom message string returned by the script task?
Please assist me.
Thanks,
Venkat.
Best Regards, VenkatNo, I haven't tried events.
Could you please point me some tutorials or urls where i can get information?
Thanks,
Venkat.
Best Regards, Venkat
Click on the
link in the previous reply. With for example Dts.Events.FireWarning(.......) you can create a warning with a custom text in it.
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com |
Twitter -
I have a script task written in C# that creates an array of strings "arrayFields" after parsing a text file. It saves the array of strings in a DTS variable.
Each row in array represents a row is comma separated and is a row that must be inserted into a table. For example,
X and Z are fields in the table
X1, X2,....Xn
Z1,Z2,...Zn
I am using a Foreach Loop to grab each row and then Execute SQL Task to take each row from the array and insert each field per row in a table,
The SQL is something like,
INSERT dbo.table values(field1, field2,...fieldn) arrayFields?
What should this this INSERT look like?I guess you implemented
Shredding a Recordset
Based on what I understood (correct me if I am wrong) you have difficulties mapping the input parameters, if so here is the guide
http://www.sqlis.com/sqlis/post/The-Execute-SQL-Task.aspx
In short it might look like
INSERT dbo.table (ColumnA, ColumnB,...) VALUES (?,?...)
The syntax for the T-SQL INSERT is http://technet.microsoft.com/en-us/library/dd776381%28v=sql.105%29.aspx
Arthur
MyBlog
Twitter -
Script task within child package - breakpoint wont hit, trying to find missing variable
Im calling a child package and its failing on a script task with a message which indicates one of the variables cant be found
The script threw an exception: The element cannot be found in a collection.
So I remove the readonly/readwrite section, and place a breakpoint on the very first line of the script task. When I run the main package, by breakpoint on the child package script task isnt hit but I still get the error about the missing variable.
How can I find out which variable its complaining about?You can raise an event in the script using FireInformation and pass into it the variable content as string
examples:
http://technet.microsoft.com/en-us/library/ms136054.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
The variable content will put into the Output window (go to View menu to enable it).
Arthur My Blog -
Get an Alter XMLA string via C# script task
Hi,
I have an alter Database XMLA file that needs to be deployed to an Analysis Server only if there was a change with the existing database.
I have a C# script task that checks if the DB exists before deploying.
What I need to add, is code that compares the alter Database XMLA file with the existing DB metadata.
It would be good enough to get code example of how to extract the XMLA using AMO.Hi ,
Please refer the below link for sample code
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/5b17c421-699d-4dbf-849c-0531f4e0411e/extract-the-xml-form-dsv-and-cube-through-net
Best Regards Sorna -
Run Powershell Script task sequence
Hi,
Anyone have good documentation on how to use the Run PowerShell Script task sequence ?
ThanksIf you are just interested in running a powershell command without creating a package, you can do this with the the Command line step by using this format in the command line:
PowerShell -ExecutionPolicy bypass -Command "& {your powershell commands}"
Here is an example of a multiline command to increase the agents cache size. Notice the ";"'s which are used to delineate a new line.
PowerShell -ExecutionPolicy bypass -Command "& {$UIResourceM gr = New-Object -ComObject UIResource.UIResourceMgr;$Cache = $UIResourceMgr.GetC acheInfo();$Cache.TotalSize = "20480"}" -
I'm trying to find a simple example VB script task using XPath to query the XML document
Why cant you use Execute SQL task for that and use Xquery functions like nodes(),query() etc available in T-SQL?
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Using Script Task to rename an excel sheet.
I'm trying to use an SSIS Script Task to rename an excel sheet.
I've found several code samples on the net but most don't compile correctly and my knowledge of VB.net or C# isin't strong enough to fix the issues. I suspect they work but not for SSIS 2012 possibly.
Found the sample below which shows no errors at design time, but fails with an Invocation error so I'm unable to even trap what the error is to help in resolving the issue.
Does anyone have any sample code that they KNOW WORKS in SSIS 2012 or can see what the problem is ?
Dim oMissing As Object = System.Reflection.Missing.Value
Dim xl As New Microsoft.Office.Interop.Excel.ApplicationClass()
Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim laPath As String = "C:\Test.xlsx"
Try
xlBook = DirectCast(xl.Workbooks.Open(laPath, oMissing, oMissing, oMissing, oMissing, oMissing, _
oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, _
oMissing, oMissing, oMissing), Workbook)
xlSheet = DirectCast(xlBook.Worksheets.Item(1), Worksheet)
xlSheet.Name = "Sheet1"
xlBook.Save()
xl.Application.Workbooks.Close()
Dts.TaskResult = ScriptResults.Success
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK)
Dts.Events.FireError(1, ex.TargetSite.ToString(), ex.Message.ToString(), "", 0)
Dts.TaskResult = ScriptResults.Failure
End Try
Thanks.Why do you need a script task for this? You can define the sheetname at the time of data transfer itself by creating a new sheet with required name
See this as an example
http://visakhm.blogspot.in/2013/09/exporting-sqlserver-data-to-multiple.html
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Error While executing a SSIS package which contains a script task through SQL Server Agent job
Hi,
I have a SQL Server 2012 SSIS package with a script task along with other tasks [data flow, execute sql tasks ]. When I manually executed the job through BIDS, its completed successfully.
Then I have automated the execution of the package through SQL Server Agent Job. But when I executed the package through SQL Agent job, it runs successfully for all the tasks except script task. When it comes to execute the Script Task, it is getting failed
with the below error message.
"Error: 2012-08-29 12:45:14.67
Code: 0x00000001
Source: Script Task
Description: Exception has been thrown by the target of an invocation.
End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 12:45:10 PM
Finished: 12:45:14 PM
Elapsed: 4.353 seconds
I have installed the SSIS on the 64-bit environment and SSIS service is running. Also I tried to run the job through 32 bit [job option] but I am getting the above error in all cases.
Any help will be greatly appreaciated !
Thanks,
Navin
- naveen.reddyHi Arthur,
My script task access the excel files in a network share, refresh them all and save them. When I execute the ETL manually or thru DTEXEC, it is executing successfully. I am facing the issue when I am executing thru SQL Agent Job only. Logging also showing
the same error.
"Error: 2012-08-23 12:45:14.67
Code: 0x00000001
Source: Script Task
Description: Exception has been thrown by the target of an invocation.
End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 12:45:10 PM
Finished: 12:45:14 PM
Elapsed: 4.353 seconds
- naveen.reddy -
Script task error during the creation of partition by reading a table and using AMO - SSAS 2012
Hi,
I need to create SSAS (tabular) and process partitions in an authomatic manner. Moreover, the partitioning is respect to a category, an year and a month.
Category, year and month are resident on a table to read to create the SSAS partitions.
So, in a SSIS pkg:
a. I've created a data flow task to read the SQL Server table having category, year and month data,
b. I've connected the output of the ole db source as the input for a recordset destination, associated to an object variable,
c. I've used a for each loop container (ado enumerator) specifying the object variable and three variables, for category, year and month,
d. inside the for each loop container I've created a script task using AMO (visual basic) to control for any existing partitions, if not presents to create the new ones and then to process them.
For the first iteration, a new partition has been created and processed successfully, but then, for other category, year and month values the script task fails. I've controlled the code many times and I've tried to put returning messageboxes but I've found
anything. The error is a generic one and no other info are returned.
Well, any suggests to me in order to solve this issue, please?
Many thanksHi, thanks, I've solved adding to the code end the SSAS server connection termination.
Bye -
Getting error message when i am trying to update the excel file using script task in ssis package
Hi Guys,
I am getting error message when I am trying to update the excel. Please find the error messages as below
Error at Update File [Update File]: Failed to compiled scripts contained in the package. Open the package in SSIS Designer and resolve the compilation errors.
Error at Update File [Update File]: BC30002 - Type 'Microsoft.Office.Interop.Excel.Application' is not defined., ScriptMain.vb, 32, 32
Error at Update File [Update File]: BC30002 - Type 'Microsoft.Office.Interop.Excel.Workbook' is not defined., ScriptMain.vb, 33, 25
Error at Update File [Update File]: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.
Warning at Update File [Update File]: Found SQL Server Integration Services 2008 Script Task "ST_050fcae972904039b4f0fe59b7528ece" that requires migration!
and the code that I am using is
Dell - Internal Use - Confidential
' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic
' The ScriptMain class is the entry point of the Script Task.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.Office.Interop.Excel
<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="",
Description:="")> _
<System.CLSCompliantAttribute(False)> _
Partial
Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
Public Sub Main()
Dts.TaskResult = ScriptResults.Success
'Dim proc As System.Diagnostics.Process
'kill all instances of excel
'For Each proc In System.Diagnostics.Process.GetProcessesByName("EXCEL")
' proc.Kill()
'Next
Dim excelnacomm As
New Microsoft.Office.Interop.Excel.Application
Dim wbnacomm As Microsoft.Office.Interop.Excel.Workbook
wbnacomm = excelnacomm.Workbooks.Open("http://test.xlsx")(renamed
the excel)
wbnacomm.RefreshAll()
wbnacomm.Save()
wbnacomm.Close()
excelnacomm.Quit()
Runtime.InteropServices.Marshal.ReleaseComObject(excelnacomm)
End Sub
End
Class
Please let me know what could be the reason
Smash126Download:
Microsoft Office 2010: Primary Interop Assemblies Redistributable
How to: Add or Remove References By Using the Add Reference Dialog Box / How to:
Add and Remove References in Visual Studio (C#)
Olaf Helper
[ Blog] [ Xing] [ MVP] -
SSIS/Script Task/ VB 2008 Help Urgent...
Hi Guys,
Simple Script Task, just rename Excel tab, here is my code...
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.Office.Interop.Excel
Imports System.IO
Imports System.Text
<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
Public Sub Main()
Dts.VariableDispenser.LockForRead("User::FileName") ' File Name Variable
Dim variablesList As Variables
Dts.VariableDispenser.GetVariables(variablesList)
'Dim SFileName As String
'SFileName = variablesList("User::Filename").Value.ToString
' Dim vars As Variables 'New Added For Variable
Dim oMissing As Object = System.Reflection.Missing.Value
Dim xl As New Microsoft.Office.Interop.Excel.ApplicationClass()
Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
'Dts.VariableDispenser.LockForRead("Filename") 'New Added For Variable
'Start For Variable
'Dim File As String 'New Added For Variable
'File = CType(vars("Filename").Value, String) 'New Added For Variable
'MsgBox(Prompt:="Filename")
'Dim laPath As String = "C:\Excel\ABC_dr_daily_lf_10-07-14.xls" 'My File Name
Dim lapath As String = variablesList("User::FileName").Value.ToString 'New Added For Variable
'MsgBox(Prompt:="Filename")
xlBook = DirectCast(xl.Workbooks.Open(laPath, oMissing, oMissing, oMissing, oMissing, oMissing, _
oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, _
oMissing, oMissing, oMissing), Workbook)
xlSheet = DirectCast(xlBook.Worksheets.Item(1), Worksheet)
xlSheet.Name = "data"
xlBook.Save()
xl.Application.Workbooks.Close()
Dts.TaskResult = ScriptResults.Success
End Sub
End Class
Finally I intalled MS Excel 2007 on my Dev Server. Here is the error that I am receiving....
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException:
Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type 'Microsoft.Office.Interop.Excel._Application
'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}'
failed due to the following error: Library not registered.
Please help me, this is very urgent.
Thank You.No I didn't upgrade my SQL Server. OMG this error making me ehhhhhh.
Here I solve my problem.
RUN>REGEDIT> and look for "Office.Interop.Excel" and delete the old version. I am using Excel 2007, 14.0.
It solve my Problem.
Thanks All.
Maybe you are looking for
-
Hi I want to get the zip file having multiple .dat / .csv files from another server to application server.I want to unzip it and store the individual file to the folder. Could you please help me. Thanks in advance. Amit
-
Ipad tuck on plug to itunes icon please help, ipad tuck on plug to itunes icon please help
updated ipad2 now its saying plug into itunes icon please help me need this done as its my sons will i lose every thinkon it now
-
Problem in Deploy theme in Webspace server 10.0
Based on the steps given in SunGlassFishWeb Space Server 10 Developer's Guide, I have modified a theme in Dreamweaver. Exported the war. When I try to deploy in Webspace server, it says the deployment is successful. But the {color:#0000ff}*newly depl
-
Webhelp generated from Robohelp 7 doesnot work fine with Google Chrome
Why is it that Webhelp generated from Robohelp 7 doesnot work fine with Google Chrome? Are there any issues with browser compatibility for Google Chrome? Please let me know how to fix it.
-
I bought at Sharp 1.3CU microwave on January 18th, 2014, which went bad today. I took it back to the store for a exchange. Upon entering the store, carrying this microwave, I got to stand in line for about 3 minutes, holding this microwave. Understan