Save ConnectionManager For Future Use

Dec 12, 2007

Hello,

I just create FLATFILE connection manager from UI, and now I would like save this connection manager for future use. I am not able to do this and now I am really stuck in the middle of coding.



ConnectionManager class has SaveToXML and LoadFromXML methods from IDTSPersist, these methods are not for use, but I am able to save CM to XML, however not load. Every try for loading ends with error 0xC0011008. The XmlNode.Name == "DTS:ConnectionManager"



CM class is not serializable, thus standard .NET feature is not working, also is sealed.



IDTSConnectionManagerFlatFile90 of cm.InnerObject is not serializable either, because it is interface and cm.InnerObject cannot be cast to ConnectionManagerFlatFileClass because is the COM.



Is there any way, how to save and load ConnectionManager besides writing of tons of code for each of connection manager type?


I am able to save and load package with connection manager, but it is not exactly what I want. Also is there possibility to work with XML in packages, but this is not "right".

Thanks

Erik

View 7 Replies


ADVERTISEMENT

VSA And ConnectionManager - AcquireConnection

Jan 19, 2006

Hi all

In a SSIS Package I have defined a ConnectionManager to
a SQL Server 2005.
Now I am trying to query data in a Visual Studio for Application Script.

I tried the following:
Dim local_SQLConnectionManager As Microsoft.SqlServer.Dts.Runtime.ConnectionManager
Dim local_SQLConnection As New System.Data.SqlClient.SqlConnection
Dim local_SQLDataReader As System.Data.SqlClient.SqlDataReader
Dim local_SQLCommand As New System.Data.SqlClient.SqlCommand

local_SQLConnectionManager = Dts.Connections("Name of ConnectionManager")
local_SQLConnection = CType(local_SQLConnectionManager.AcquireConnection(null), System.Data.SqlClient.SqlConnection)
local_SQLConnection.Open()
local_SQLCommand.Connection = local_SQLConnection

local_SQLCommand.CommandText = "SELECT something"
local_SQLDataReader = local_SQLCommand.ExecuteReader()
If local_SQLDataReader.Read Then
Dts.Variables("Just a variable").Value = local_SQLDataReader.GetString(0)
End If
local_SQLDataReader.Close()

It always stops on the line with the AcquireConnection:
Unable to cast COM object of type 'System.__ComObject' to class type 'System.Data.SqlClient.SqlConnection'. and so on ....

Thanks for any help

Frank Uray

View 3 Replies View Related

HOW To Cast An AS ConnectionManager Into A SriptTask?

Dec 22, 2006

In fact, we could use AMO in the Sript Task, just by include the AMO.dll, many guys have talked about it on the forum.

But now, O my god, I met a big problem.

I declare a AS connectionManager in the SSIS package. In the Script Task I can't use it.

If this is a OEL DB ConnectionManager and connect to SQL Sever, I know I could write this inside the Sript Task:

Public myKPIConnection As SqlClient.SqlConnection

myKPIConnection = _
DirectCast(Dts.Connections("CYF.KPIOperation").AcquireConnection(Dts.Transaction), _
SqlClient.SqlConnection)

Then I could use myKPIConnection inside the Task.

But, How to do the similar thing to a AS ConnectionManager? I need to DirectCast the AS connectionManager to What?

By the way, the only thing I want to do is to Start an AS transaction inside the Sript Task, and let a Process Task outside to be enlisted in the trransaction. So I need to use the same AS connectionmanager.


Thanks.

View 2 Replies View Related

Get FlatFile Columns Through ConnectionManager

Mar 29, 2006

The CreatePackage sample provided with SQL Server programmatically creates a package that has a source type of OLEDB to a flat file destination. I am building exactly the opposite, source=flatfile, destination=SQL Server. I expect that will be a more common scenario is using SSIS.

The problem I have is populating the source columns in the FlatFileSource connection manager programmatically. I know it can be done because it happens when you build a package in Visual Studio. What I'd like to know is how to do it programmatically in the object model. How can I interrogate the datasource through the connection manager to find out what columns it has? If I know, I can add the columns to the connection manager. My sample below does this, but it doesn't know the number of columns in the source so that value is hardcoded. I'm guessing there is a better way to do this than what I've got below.

How can I find the number of columns in my source so I can add the columns to the connection manager?

Thanks.



Private Sub AddColumnsToFlatFileConnectionManager()
Dim ff As wrap.IDTSConnectionManagerFlatFile90 = Nothing

For Each cm As ConnectionManager In _Package.Connections
If cm.Name.Equals(_ExternalConnectionID) Then
ff = TryCast(cm.InnerObject, wrap.IDTSConnectionManagerFlatFile90)
DtsConvert.ToConnectionManager90(cm)
End If
Next

If Not ff Is Nothing Then

Dim col As wrap.IDTSConnectionManagerFlatFileColumn90
Dim name As wrap.IDTSName90
Dim Min As Int32 = 0
Dim Max As Int32 = Min + 3 ' *** HARDCODED LIMIT ***

For cols As Integer = Min To Max
col = ff.Columns.Add()

If cols = Max Then
col.ColumnDelimiter = vbCrLf
Else
col.ColumnDelimiter = ","
End If

Dim width As Int32 = 50
Dim DataType As wrap.DataType = wrap.DataType.DT_STR

col.ColumnType = "Delimited"
col.DataType = DataType
col.MaximumWidth = width
col.DataPrecision = 0
col.DataScale = 0
col.ColumnWidth = width
name = TryCast(col, wrap.IDTSName90)
name.Name = "Column " & cols.ToString

Next

End If

End Sub

View 4 Replies View Related

Password Property In ConnectionManager

Jan 18, 2007

I'm developing a custom manager in SSIS that has several properties defined. One property is a password string that is visible in clear text in the properties pane. I'm trying to figure out how to create a masked field in the properties pane that will mask the text and not present this in clear text. Can someone send me instructions or code samples in C# for doing this? BOL doesn't provide any information on doing this.

View 3 Replies View Related

SSIS ConnectionManager In Script Task

Apr 8, 2008

I have a SourceConnectionExcel in my SSIS package.  This path to this is configured in the .dtsConfig file.  My question is, how can I get the path from within a Script Task? 
 I ws thinking something like this might work, but no dice.
Dts.Connections("SourceConnectionExcel").Properties("ExcelFilePath")

View 4 Replies View Related

Child Package ConnectionManager Visibility

Jul 20, 2006

Hopefully a simple question about parent-child package relationship. For this example, let's say I have a simple setup - one parent package: parent.dtsx, and one child package: child.dtsx. The parent package calls the child package via the ExecutePackage Task.

If I add an OleDB ConnectionManager to the parent package called MySqlConnectionManager, should I be able to reference this connection via a script task (or custom component) from my child package? I realize that I will have a problem doing this at design time, but I thought I could get around it with the script task or custom component. That said, when I look in the Connections collection at run-time from within my child package, I do not see the parent package's MySqlConnectionManager. Am I missing something, or is this the way it was intended to work?

Thanks,

David

View 6 Replies View Related

Accessing ConnectionString From ConnectionManager In A Script Task Ends With Login Failed! WHY!!

Feb 8, 2007

So in a script task for one of my packages I have a connection manager to an dtsConfig OLE DB.

This is the code

Dim ConnectionString As String = Dts.Connections("db_stage").ConnectionString
Dim sqlConnection As SqlConnection = New SqlConnection(ConnectionString )

I get a login failed for
user...But if I hardcode the connectionString, including the password this works.

1) Why is it that the ConnectionString from the connection manager omits this password?
2) Since this is an OLE DB, is there anyway to set the Data Source Designer to omit the "Provider=ABCDED.1" section?

Thanks!
Tony

View 5 Replies View Related

SQL Server 2005 - Save Tran Save Point Name Case Sensitive?

Feb 11, 2006

Hello:I didn't find any documentation that notes save point names are casesensitive, but I guess they are...Stored Proc to reproduce:/* START CODE SNIPPET */If Exists (Select * From sysobjects Where Type = 'P' and Name ='TestSaveTran')Drop Procedure dbo.TestSaveTranGoCreate Procedure dbo.TestSaveTranAsBeginDeclare@tranCount int--Transaction HandlingSelect @tranCount = @@TRANCOUNTIf (@tranCount=0)Begin Tran localtranElseSave Tran localtranBegin Try--Simulate Error While ProcessingRAISERROR('Something bad happened', 16, 1)/*If this proc started transaction then commit it,otherwise return and let caller handle transaction*/IF (@tranCount=0)Commit Tran localtranEnd TryBegin Catch--Rollback to save pointRollback Tran LOCALTRAN --<< NOTE case change--Log Error--Reraise ErrorEnd CatchEndGo--Execute Stored ProcExec dbo.TestSaveTran/*Should receive the following message:Cannot roll back LOCALTRAN. No transaction or savepoint of that namewas found.*//* END CODE SNIPPET */What is really strange, if there is a transaction open, then no erroris thrown. So if you execute as so:/* START CODE SNIPPET */Begin Tran--Execute Stored ProcExec dbo.TestSaveTran/* END CODE SNIPPET */There is no "Cannot roll back LOCALTRAN...." message.Questions:1-)Can someone confirm save point names are case sensitve and this isnot happening because of a server setting?2-)Is this a logic error that I am not seeing in the example codeabove?We have changed our code to store the save point name in a variable,which will hopefully mitigate this "problem".Thx.

View 4 Replies View Related

The Future

Jul 8, 2004

I have another question I'm just looking for some opinions on this. I created a database through sql (sql engine, access 2000 client side) now this database has Hyperlinks in it which lead to the employee's documents which on in acrobat pdf. Does anyone for see an problems that might occur wth that???

Thanks again

View 10 Replies View Related

Future With SSIS

Jun 29, 2006

Hi,
 
We have a NT service built via Visual Basic 6 which fires dts processes on demand according some criteria. Well, on the whole and basically only for the following rule:
-dts process is executed when our service recognize a concrete plain file leaved in a folder. It€™s generally generated for a mainframe JCL along with a activator file (.nul file, empty). Each application own a folder and each folder have lots of files as the aforementioned ones. Scheduler for that is an ASP application that lives within a intranet. It also is a monitor and logger
 
In that schema, keeping on mind that eight out of ten are ETL processes, critical ones and on daily-basis, our question is, how to handle on with this stuff using by sql25k and its powerful SSIS?? Migrating such dts packages to SSIS packages is a piece of cake (now no before; thanks Jamie, Michael and other guys for your awesome help) because of its tipology. However our main concern is what the hell to use. Centralized dtsx package running all day long as a service, listening and checking for files? .Net windows application either vb or c#? aspx solution? Set of .vbs interlinked among them?
 
This is a old post/goal. In spite of we have not defined any deadline for that, what the heck as time goes by  is more urgent for us. A restriction: we can€™t to programme nothing from our sql25k production cluster physically. Any stuff will be done on workstations.

In terms of cost, no problem at all. We are interested in hear thoughts and point of view about which is the most effective way

Thanks in advance,

View 3 Replies View Related

How Can I Change The Default Save-As/Save Directory

Jun 26, 2007

I am new to sql sever management studio express, but a long time query analyzer user. This is a very basic question.



I want to change the default directory in sql server management studio express so that when I go to save a query, it is already pointed to the correct one. Where do I change that?



Thanks,

Nanci





View 2 Replies View Related

Past And Future Date

Aug 26, 2006

How should I find the dates for 3 days past and 5 days future. Such as TodayDate-3 and TodayDate+5 base in the date only, discarding the time?

View 5 Replies View Related

Setting A Date In The Future

Dec 3, 2007

I have had one tossed at me that I've never dealt with before. While I've done calculations on date parts I'm a little lost on how to proceed. They want a stored procedure that will take date from one field and add three days to it and that would update another field. The three days must account for weekend and holidays.

The date would be receiveddate 12/03/2007 and the due date 12/06/2007. If someone has run into this and has some sample code it would be a great help.

Any help would be appreciated.

View 14 Replies View Related

Past And Future Date

Aug 26, 2006

How should I find the dates for 3 days past and 5 days future. Such as TodayDate-3 and TodayDate+5 base in the date only, discarding the time?

View 20 Replies View Related

How To Test Application With Future Date?

Aug 6, 2004

I need to test an HR application with a future date without changing the system date. If I just rollback the the date fields in the data, it may not work as the application itself might be using getdate() type of functions..

Any thoughts on how to do this w/o touching the system date setting?

Thanks.

View 1 Replies View Related

RAPI, CCeDBDatabase, EDB, CEDB, And The Future

Jan 15, 2006

Hi,
 
I'm trying to migrate to VS2005 and prepare for future Windows Mobile releases.  My app uses MFC, CCeDBDatabase, and RAPI from the desktop to sync with the device version of the app.  Works great now, but I'm worried about how many different ways it will be broken in the future .
 
My questions - first, are we pretty certain that CEDB will NOT be supported after WM5?  Next, is there, or will there be, a CCeDBDatabase class for EDB?  VS2005 seems to know nothing about CCeDBDatabase.  What should I be doing with the CCeDBDatabase; do I need to re-write everything using only API calls?  Also, there is no RAPI for EDB, is this correct?  If so how can I switch to EDB and still communicate/sync with the desktop using RAPI?  As always, any advice is greatly appreciated, thanks!
 
Mike B.
 
 

View 1 Replies View Related

Future For Spatial Data Types?

Jan 1, 2008

Can anyone comment on the future for spatial data types in SQL CE? This would be a very useful feature for mobile devices connected to a GPS.

View 4 Replies View Related

Features Not Supported In Future SQL Server Versions

Nov 29, 2007

Books online "Deprecated Database Engine Features in SQL Server 2005" makes references to "Features not supported in Future SQL Server versions".

http://msdn2.microsoft.com/en-us/library/ms143729.aspx

Will there be an Upgrade Advisor available to help us identify issues with our code any time soon or should we start building our own?

View 3 Replies View Related

Analysis :: Forecasting Calculations For Future Dates?

Jul 7, 2015

I have built an analysis cube and I am wondering how I can now somehow add in some kind of forecastinbg to it?

I have a time dimension in years, quarts, months, days.

Is there a way I can show forecasting calculations for future dates?

View 2 Replies View Related

Some SET_ANSI Options Will Be Removed In Future Releases

Aug 7, 2007

According to SQL Server 2005 Book Online, the following "Important" note applies to SET_ANSI_NULLS and SET_ANSI_PADDING:

"This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature."

However, these options are automatically inserted in the auto-generated scripts (such as CREATE TABLE) in SQL Server 2005 Management Studio.


I am working on new scripts that include these options. What are the replacements for these options? Does the above note apply to ALTER DATABASE options? Please give me advice!

Thanks!

View 2 Replies View Related

Query DateTime DataType For Current Or Future Events

Oct 12, 2006

I have a sql server express 2005 database with a table named Events with a column named Date (datetime datatype).  I want a query that will display all rows that are either current or future but not past.  I suspect there is a simple way of doing this.  As a Newbie searching archived threads this is what I have come up with so far.  I determine the number of days from present:SELECT DATEDIFF(day, Date, GETDATE()) AS NumberOfDays FROM EventsThis yields number of days from present with positive numbers in the past and negative numbers in the future.  Thus setting a WHERE clause to <= 0 would limit my results to present or future events.  Something like this:SELECT * FROM EventsWhere DATEDIFF(day, Date, GETDATE()) AS NumberOfDays <= 0The error message states: "Incorrect syntax near the keyword 'AS'"This feels like a clumsy way to approach this problem, but I have to start where I am.Any suggestions on how to proceed will be greatly appreciated.

View 2 Replies View Related

Want To Start Consulting In Future, Need Help With Laptop And Sql Server Version

May 12, 2008

Hello all!

I want to get into consulting (perhaps a little at first and more once I can support myself on it solely). I am about to start the purchase of a laptop soon, and I want to know which components I should focus on the most. I also want to know which version of SQL Server I should purchase.

From my studies and what I have learned (about to take the test to get my sql server 2005 certificate) I am going to assume that I want to get SQL Server 2005 developer software. However, the part that is not touched on very often, is if I am working with a client that has say, SQL Server 2005 enterprise, x64 exition, and I have developer IA64 edition, would I be able to connect and work on their server?

As far as the hardware is concerned, I am thinking I want a laptop with a large enough screen (I currently get a discount through hp where I currently work and am looking at the models that have a 17 inch screen) so I don't go blind trying to work . I am also thinking I don't need an extremely powerful processor, but I am not sure between athlon and pentium on which I Should choose since I do not have much experience in this area with sql server. I know I want at least 2GB of memory for the simple fact that sql server isnt the only thing I will be doing on the laptop and want some headroom. I also want a large enough hard drive to hold everything, but I definitely want to see if I can get a 7200rpm drive vs a 5400rpm for the simple fact that I have noticed a significant difference in read and write speeds between the 2 drives. I am not too fussed over the video card, as I am not into graphics design or high-end video games (I think world of warcraft is the most intense I have bought in years). I am also thinking that because I wont need to have a very powerful video card, that a mega powerful battery is not super important.

These so far are my thoughts. Please let me know your opinions on what I should focus on/get

View 3 Replies View Related

Searching Varchar Field That Contains Future Dates Error

Feb 25, 2008



I am doing a search on a column of type varchar, the columns all contain dates in the future. When i perform a query

SELECT [CIFPan]

,[CIFMemNum]

,[CIFLName]

,[CIFFName]

,[CIFExpDate]



FROM [FutureSoft].[dbo].[zCIFRecord]

WHERE CAST([CIFExpDate] AS smalldatetime) between '12/01/2000' and '01/30/2015'


I get error:


Msg 295, Level 16, State 3, Line 1

Conversion failed when converting character string to smalldatetime data type.


I can use this same query on an exactly same other field that contains dates in the past. Is there some kind of limitation on the dates as far as them being in the future or past?

View 4 Replies View Related

T-SQL (SS2K8) :: Query To Predict Future Job Schedules From MSDB Tables

May 8, 2014

I want to query my msdb job and jobschedule related tables to generate a list of runtimes for each of these jobs for the next day or any future date. This query should output JobID, Run_Date(YYYYMMDD), and Run_Time(HHMMSS).

If I have 3 jobs with...

Job#1 scheduled to run once every 4 hours between 6 AM and 10 PM
Job# 2 scheduled to run every 15 minutes between 11 AM and 1 PM
Job# 3 scheduled to run every minute between 4 PM and 4:15 PM

my output should look as below ....

View 1 Replies View Related

Time Series, Incorporating Future Input Data For Prediction

Sep 25, 2006

Hi,

I've got a time series of the number of new customer subscriptions, which
is the target attribute to predict. The number of subscriptions depends on
various marketing activities, such as mailings, which are known within
the time series for the past.


If I train an ART (MS Autoregression Tree), it learns the trend pattern
as well as the correlations between the marketing activities and the
target (cross-correlations), right?
What I would like to do is, providing the model with some marketing activity
planning for the future and let the model predict the number of new
subscriptions based on a) the past trend pattern and b) the future activities.


Unfortunately a time series algorithm does not provide some kind of scoring for input data.


What would be the best approach to solve this problem? How about linear regression?
But how to train a regression model with trend patterns?


Thanks for your help!

View 1 Replies View Related

I Have A Web Site Where I Input Stories And Set The Publish Date To Some Time In Future And Set An Hour From 1-24....

Sep 20, 2007

i need to be able to do an sql call whereby i can check the day and hour for publishing.eg select story where day = ?? AND hour = ?? any one know the best way to do this.
i need to call out date as a day number or someting and the getdate as just the hour??? anyone know how??

View 1 Replies View Related

Power Pivot :: Calculating Values For Future Dates Based On Past Values

Nov 13, 2015

I am working with a data set containing several years' of monetary values. I have entries for past dates and the associated values, and I also have entries for future dates. I need to populate the values of the future date records with the values from the same date the previous year. Is there any way this can be done in Power Pivot?

View 6 Replies View Related

How To Select All Dates Upto Todays Date And Include The First Next Future Date

Jan 11, 2006

hello
how can i select all dates upto todays date and include the first next future date in a given data base

say todays date was the 01/06/2006 (MM,DD,YYYY)

below is a mock data base
id date (MM,DD,YYYY)
1 01/02/2006
2 01/04/2006
3 01/06/2006
4 01/09/2006
5 01/20/2006

i want to select all dates equal or less that 01/06/2006 and include the first next future date .. and in this case it would be 01/09/2006

so the results would return

1 01/02/2006
2 01/04/2006
3 01/06/2006
4 01/09/2006

View 2 Replies View Related

Transact SQL :: Return Date Which Is 15 Working Days Prior To Given Future Date

Oct 28, 2015

i have written a sql function which returns only number of working days (excludes holidays and Weekends)  between given StartDate  and EndDate.
                 
USE [XXX]
GO
/****** Object:  UserDefinedFunction [dbo].[CalculateNumberOFWorkDays]    Script Date: 10/28/2015 10:20:25 AM ******/
SET ANSI_NULLS ON
GO

[code]...

I need  a function or stored procedure which will return the date which is 15 working days (should exclude holidays and Weekends) prior to the given future Date? the future date should be passed as a parameter to this function or stored procedure to return the date.  Example scenario:  If i give date as  12/01/2015, my function or stored procedure should return the date which is 15 working days (should exclude holidays and Weekends) prior to the given date i.e 12/01/2015...In my application i have a table  tblMasHolidayList where all the 2015 year holidays dates and info are stored.

View 18 Replies View Related

Transact SQL :: Establishing Unique Sales ID To Future Sales IDs From Original Sale

May 19, 2015

i am trying to find a way to link an 'initial' Sale ID of a product to 'future' Sale IDs of products that will trace back to the original Sale ID.For example, if I call the original sale , 'Sale ID #123',  how can i link future Sale ID's (child[ren]) and all future sales to the original Sale ID #123? Can I use a Surrogate Key or similar function?

Parent:Sale ID #123
Children: Sale ID # 456,
Sale ID #789,
Sale ID #.....

how I can link the original Sales ID (Parent) to Sale ID's (child[ren]) of future purchases currently existing and in the future going forward?

View 4 Replies View Related

How To Save Img In Sql Db

May 20, 2007

how to save img in sql db ,I need some one to tell me

View 1 Replies View Related

Save Xml In Sql

Jun 19, 2007

Hi...
I want to save xml string in sql, but, i have problem, the length of the string is 19,000 - 24000 chars, and nVarChar can contain 4000 chars, and binary can contain 8000 chars...
so, how can i solve this?
thank you...

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved