Better Way To Deploy SSIS Pkg

Nov 2, 2007

Hi, all,

I am looking for a way to deploy SSIS pkg from dev to test/prod.

Both BOL and MSDN/TecNet samples are complicated. Do I miss the old good days of DTS!

Thanks!

View 1 Replies


ADVERTISEMENT

Which Is Best Way To Deploy SSIS Packages?

Sep 7, 2007

I have 9 Dimensions and 16 Fact Packages in my SSIS Project. All these 25 packages uses one source (SQLServer A - staging) and a seperate destination (SQlServer B - Warehouse) . I have completed my development. Now i want to move these packages to production environment. I have a Parent package to control all these facts and Dimensions.

1. Should I always change the Protection level of the Package to "DontSaveSensitive" before moving to some other machine where it has to run under a different user?

2. Which is the best way to follow for configuring the connection strings in my development?
Having a variable for each connection string @ parent project level and pass it to child packages
or
Configure the connection strings directly in a XML config file for one package and in all my other packages i have to say the package to Reuse the existing config file as the source and dest is same for all these packages?

And am hearing one more buzz word "Proxies for running SSIS packages". Any information on this also will help me.

Please help!!!

Thanks in Advance.

-Saravanan



View 4 Replies View Related

About: Deploy SSIS Packages To MSDB

Apr 10, 2008

Hi, everyone,
Here's the situation:


I want to deploy my SSIS packages on SQL's MSDB database, but i can't open the MSDB directory
in Integration Services's Management Studio.



The error message said :

can not load files or components System.EnterpriseServices.Wrapper.dll'
System can't find the special file。 (MsDtsSrvr)

------------------------------

can not load files or components 'System.EnterpriseServices.Wrapper.dll'
System can't find the special file。 (System.EnterpriseServices)

Exception happened whith HRESULT: 0x80070002)



I had confirmed my .net framework is 2.0.50727, Wrapper.dll version is 2.0.50727.1433,

SQL DataBase Engine version is 9.0.3042, Integration Services version is 9.0.3054


This problem happened after i update Integration Services to SP2

Any ideas how to solve it

Thanks a lot.

View 7 Replies View Related

Error While Trying To Deploy SSIS Package

Sep 1, 2006

Hi,

I am trying to deploy a DTSX package to 32-bit SQL Server 2005 in a 64-bit machine from my installer.
I am getting the following error in the SaveToSQLServer method:

The SaveToSQLServer method has encountered OLE DB Error code 0x80004005 (Communication Link Failure). The SQL statement that was issued has failed.

However I am not facing this problem when I try to deploy the DTSX package to a 32-bit SQL Server 2005 in a 32-bit machine.

Can anyone tell me why this happens and how this could be solved?

Thanks,
Sandhya

View 2 Replies View Related

Deploy SSIS Package To Server

Aug 6, 2007

Ok, I created SSIS packages on my local box. All of my packages are using config files for the db connections and other configurations that'll be changed per environment. My question is how do I deploy the .dstx file and the associated config file to the servers?

Right now I'm running the packages in BIDS as I create them. I now want to run them on an actual server

View 4 Replies View Related

Deploy SSIS Without Installing SQL Server 2005

Apr 13, 2007

SSIS packages can also be run on systems where SQL Server is not installed.



How do we package the DTUTil.exe and DTEXEC.EXE. with the manifest file

How do we execute the packages using the file system utility.



Any suggestions/help is appreciated.



Regards,

Rashmi



View 7 Replies View Related

Noob To SSIS Package Configure And Deploy

Mar 19, 2007

Hi there

I am fairly new to SSIS, I got my package running fine in my development environment with the connection managers (connecting to 3 databases on the same server, with username and password, not Integrated security) and all.

The problem comes in when i want to deploy my package or execute it outside of the development environment.

When I execute the .dtsx file in my project it brings up the Execute Package Utility and I just click Execute, thinking it should work, but not, any ideas??

So I read some of the forums and got looking into the configuration file, suppose that it does not carry the connection manager settings thru, but dam that still doesn't work for me?

The whole idea is that I will be executing the package from my C# code, so does my package have to be just on the server in a folder or does it have to be installed in the db? which is best??

Hope anyone can help me!!

Thanks
Jamie

View 1 Replies View Related

Permissions To Deploy SSIS Package To SQL Server

Jan 31, 2008



What are the minimum permissions required to deploy an SSIS package to SQL Server? Here is what I have tried:

1. No additional permissions (i.e user created with no special permissions):

Deployment Error: No execute permissions on sp_put_package???

2. Dbowner role on msdb dataabase

Deployment Error: The SaveToSQLServer method has encountered OLE DB error code 0x80040E14 (Access to Integration Services package 'xxx' is denied.). The SQL statement that was issued has failed.

3. Sqladmin role on login: No errors

Most DBAs are reluctant to give sqladmin role to developers. Is there any way around this restriction?

View 4 Replies View Related

Need Help To Deploy SSIS Package In Production And To Schedule It

Dec 19, 2007



Hi All,

I have created an SSIS package which will import data from EXCEL file to SQL server. I had assigned the excel file path using an expression which wil be a combination of the folder path where the excel file resides + file name + date+extension. I also assigned the connection string for the OLEDB using the Expression. I have also exported the Folder path and the eonnection string variables to the package configurations and i have created the deployment project, which contains the package, packagemanifest and the package config file.

Now i need to know the steps to install the package in the production server and the steps to schedule the job in the sql server.

any of you plz give me the link to find the steps or plz tel me the things that i have to do.

Thankz to all

View 5 Replies View Related

Unable To Deploy SSIS Package On 64 Bit Enterprize

Mar 15, 2006

I have developed a SSIS dts package, its running fine from my computer, but the problem is when I am deploying it on actual server then giving me error for connection

scenario,

development env: dev006

three servers: srv01 (64bit), srv02 (32bit), srv03 (32bit)

in development environment, same package is getting data from srv01 and pushing it to srv02 and srv03, but when i am deploying it on srv01 then it fails to establish connection with srv01. If I have a Business Intelligence Studio on 64bit then I will check it but that Studio is available for 64bit environments.

View 1 Replies View Related

Error When Deploy SSIS With Deployment Wizard

Jul 17, 2006

I've get error when I deploy SSIS package with Deployment wizard like this



===================================

Could not save the package "C:Documents and SettingsaunMy DocumentsVisual Studio 2005ProjectsImportCommitteeImportCommitteeinDeploymentIMPORT_FS_DATA.dtsx" to SQL Server "(local)". (Package Installation Wizard)

===================================

The SaveToSQLServer method has encountered OLE DB error code 0x80040E21 (Invalid character value for cast specification). The SQL statement that was issued has failed.


------------------------------
Program Location:

at Microsoft.SqlServer.Dts.Runtime.Application.SaveToSqlServer(Package package, IDTSEvents events, String serverName, String serverUserName, String serverPassword)
at Microsoft.SqlServer.Dts.Deployment.DtsInstaller.SavePackageToSqlServer(WizardInputs wizardInputs, String packagePassword, Boolean bUseSeverEncryption, String serverName, String userName, String password, String packageFilePath, List`1 configFileNames)
at Microsoft.SqlServer.Dts.Deployment.DtsInstaller.InstallPackagesToSqlServer(WizardInputs wizardInputs)

===================================

The SaveToSQLServer method has encountered OLE DB error code 0x80040E21 (Invalid character value for cast specification). The SQL statement that was issued has failed.


------------------------------
Program Location:

at Microsoft.SqlServer.Dts.Runtime.Wrapper.ApplicationClass.SaveToSQLServer(IDTSPackage90 Package, IDTSEvents90 pEvents, String ServerName, String ServerUserName, String ServerPassword)
at Microsoft.SqlServer.Dts.Runtime.Application.SaveToSqlServer(Package package, IDTSEvents events, String serverName, String serverUserName, String serverPassword)



I've ever pass deploy wizard with test program (a little line of code) but when I've deploy with my real code it's return error I've show above



Thanks for your help

Pipope

View 3 Replies View Related

Cannot Deploy SSIS Package On 64bit SQL Server

May 17, 2006



I have a SSIS package, which get data from oracle 9i, and dump into sql server 2005 64bit itanium, its running fine. When I am deploying the package on SQL Server 2005 its showing me the error with connection. on 64bit Oracle Net manager showing its able to connect oracle successfully. I think actually the problem is with encryption, as the package is developed on 32bit machine, therefore all connection strings are encrypted for that machine. Is there some has faced same issue? please help!

View 1 Replies View Related

Integration Services :: SSIS Package Failed To Deploy

Oct 12, 2015

I have created a package using SSDT2012 studio and it is failed to deploy under sql server 2012 sp1.Data inserting into sharepoint from sql server 2008 r2 database.The error says:The package failed to load due to error 0xC0010014.

View 9 Replies View Related

Integration Services :: Deploy Or Import A SSIS Package?

Jun 5, 2015

Is it possible to deploy or import an SSIS package developed in visual studio 2010 onto a 2008 R2 integration server?

package: developed in vs2010, SQL Server: SQL Server 2008 R2. 

Trying to deploy the package onto the server.

View 3 Replies View Related

Deploy To Production Server / SSIS Writes Out Garbage Data

Apr 2, 2015

I built a SSIS(writing out to a flat file ) in 32 bit machine and it woks fine . But however when I deploy to the produciton server(64 bit) the SSIS writes out garbage data . After some research I found out that the problem with the 32 bit OS and 64 bit OS problem.What is my next step. Am I out of luck that now I will have to redesing the SSIS in 64 bit?

View 5 Replies View Related

Package Is Missing The Password When I Deploy It To SQL Server SSIS Instance

Apr 16, 2008



Hi there,

Something a little wride mysterious is happening with my package when I deploy it to run at the SSIS server instance. Everytime that I try to deploy it (from my local development environment) to SSIS server, my package is not keeping its database user and password.

As the database user and password are the same one we dont need to use the XML setting to keep these data there.

So, does anyone know what could be happening with my package and/or my deployment?



Thank you,
Luis Antonio - Brazil

View 5 Replies View Related

Integration Services :: Deploy SSIS Packages 2012 And Run Job Through Powershell

Jun 1, 2015

Any script  in ssis 2012 packages deployment  and create the jobs though power shell script.

View 3 Replies View Related

Is There Any Way To Deploy An SSIS Package (File Mode) To An App Server Without SQL Instance?

Jun 21, 2007

We would like to deploy SSIS packages as an ETL Tool to an appserver that does not have SQL Server 2005 installed. Is this possible, or does it HAVE to be executed on the server with SQL 2005 installed?

Kevin

View 4 Replies View Related

Deploy SSIS Package To Production Which Has A Connection To Oracle Databse

Aug 14, 2006

Hi There,

In SSIS package development environment, I was able to connect to an oracle database and pull data into my sql server database. I installed the client tools for oracle and I put an entry into the tnsnames.ora and I was able to connect.

But in production environment, if I deploy the package on sql server, I was wondering if I had to do the same job of downloading the oracle client tools onto my production machine --which creates a tnsnames.ora file to it default location and then edit it with tthe tns entry-- or is there a better way to do this--avoiding the download?

Can somebody plzz help me ?

Thanks.

View 10 Replies View Related

Unable To Deploy Package Using Deploy Wiz Or Mgmt Studio

Jun 18, 2007

Am getting errors trying to deploy a dtsx created by ms (the reporting services execution log one) to which I have made zero changes, but it is not working (2 errors shown below)

error from deployment wizard:
===================================

Could not save the package "H:SSISRSlogRSExecutionLog_UpdateinDeploymentRSExecutionLog_Update.dtsx" to SQL Server "xxxxxxxxxxx". (Package Installation Wizard)

===================================

The SaveToSQLServer method has encountered OLE DB error code 0x80004005 (Login timeout expired). The SQL statement that was issued has failed.


------------------------------
Program Location:

at Microsoft.SqlServer.Dts.Runtime.Application.SaveToSqlServer(Package package, IDTSEvents events, String serverName, String serverUserName, String serverPassword)
at Microsoft.SqlServer.Dts.Deployment.DtsInstaller.SavePackageToSqlServer(WizardInputs wizardInputs, String packagePassword, Boolean bUseSeverEncryption, String serverName, String userName, String password, String packageFilePath, List`1 configFileNames)
at Microsoft.SqlServer.Dts.Deployment.DtsInstaller.InstallPackagesToSqlServer(WizardInputs wizardInputs)

===================================

The SaveToSQLServer method has encountered OLE DB error code 0x80004005 (Login timeout expired). The SQL statement that was issued has failed.


------------------------------
Program Location:

at Microsoft.SqlServer.Dts.Runtime.Wrapper.ApplicationClass.SaveToSQLServer(IDTSPackage90 Package, IDTSEvents90 pEvents, String ServerName, String ServerUserName, String ServerPassword)
at Microsoft.SqlServer.Dts.Runtime.Application.SaveToSqlServer(Package package, IDTSEvents events, String serverName, String serverUserName, String serverPassword)



error from sql management studio
===================================

Invalid access to memory location. (Exception from HRESULT: 0x800703E6) (Microsoft.SqlServer.ManagedDTS)

------------------------------
Program Location:

at Microsoft.SqlServer.Dts.Runtime.Application.SaveToDtsServer(Package pPackage, IDTSEvents pEvents, String sPackagePath, String sServerName)
at Microsoft.SqlServer.Dts.ObjectExplorerUI.ImportPackageAsAction.ImportPackage(ImportPackageAsForm dlg)

View 7 Replies View Related

SQL 2012 :: Possible To Deploy A SSIS Package Without Building Integration Services Catalog On Server?

Jan 7, 2015

Is it possible to deploy a SSIS package without building an Integration Services Catalog on the server?

View 4 Replies View Related

What Does Strategy Exist To Deploy SSIS Package And My Own Data Flow Components Into A Enterparise Server?

Mar 29, 2007



I created a SSIS package and several data flow componenets for this package.



What does strategy exist to deploy SSIS package and data flow components into a enterparise server?



Thanks in advance.

View 2 Replies View Related

Deploy On The Hoster

Oct 6, 2006

Dears,I have devoloped an application ASP.NET 2.0.Before I have builded the aspnetdb throught the command then I built some tables and stored procedures on this db. (My db is sql express 2005 and my hoster db is sql 2005 workgroup)My hoster doesn't allow connection  Management studio express, doesn't allow attach or restore functionalities.Than I have built my script db (contains Tables, Views and Stored Procedures), I have substituted the dbo  with my user account in the script because my hoster doesn't allow the dbo access.I have also transfered my site files (.aspx, img, etc.) on the server.When I try to access the db I receive this error (for example when I push on the button create user):The SSE Provider did not find the database file specified in the connection string. At the configured trust level (below High trust level), the SSE provider can not automatically create the database file.   Please could you help me? Thank you.      

View 1 Replies View Related

How To Deploy The Database

Nov 9, 2007

Hi All,
Can anyone tell me,is it possible to create an exe or msi for sql stored procedures,tables and triggers?I want to deploy the database objects(stored proc,tables,views and functions) as an exe file..just like publishing and deploying the asp.net application.Is it possible for sql server database objects.Pls,let me know.
 
Thank U

View 4 Replies View Related

Which Database To Deploy

Nov 17, 2005

I'm deploying an ASP .Net application on which 20 users will be working at the same time. The database will start at less than 100mb. Is SQL EXPRESS 2005 powerfull enough to use for such an application. Thanks in advance for your answers

View 1 Replies View Related

Can't Deploy. No TargetServerURL

Jun 8, 2008

I have a report that I am trying to deploy. I right-clicked my report in the solutions explorer, then select "deploy" but then I get the following error:

Microsoft Report Designer
The project cannot be deployed because no target server is specified. Provide a value for the TargetServerURL property in the property page for this project.

So then I go to the properties page but there isn't a TargetServerURL field! There is only a file name and full path field. Does anyone know what is wrong? Could it be that I need IIS installed on my machine?

More info:
Software installed from http://www.microsoft.com/express/sql/download/default.aspx:
-Microsoft SQL Server 2005 Express Edition
-SQL Server Management Studio Express
-Install Microsoft SQL Server 2005 Express Edition with Advanced Services
-Microsoft SQL Server 2005 Express Edition Toolkit

Windows XP Home Edition

View 6 Replies View Related

Deploy .MDF To A Web Host

Mar 17, 2006

Hi all,I'm new to SQLServer (Express edition) so I was wondering: if the webhost supports SQLServer 2005 do I just need to move the .MDF file to mydirectory on the web host to be able to use it?Thanks,Lorenzo

View 3 Replies View Related

How Should I Deploy The Database

Apr 17, 2008

Hi all,
I have created a database in MS-Access. I want to deploy that database on the local server, how can i do it?

Let me clear, i have created a DSN for my database. I want to deploy a report on RServer(on SQL Server2005). This DSN will be the datasource for the report. When i am trying to deploy this report with this DSN i am getting an error message
"Cannot create a connection to data source 'DataSource2'. (rsErrorOpeningConnection)". Could any one help me?

Thanks,

View 1 Replies View Related

Cannot Deploy My Report

Jul 31, 2007

Hi, there;

I created a report using Report Sevice, but I cannot deploy it because of the security issue. If I try to open IIS, I got "Access Denied" message.

I checked another two developers' user settings, they are in the same user group as I am, but they can create/deploy report service.

So what should I need to create/deploy my report service?

cheers.

View 2 Replies View Related

Can Not Deploy Reports

Feb 27, 2008



I have created a report project file on my local machine.Now I'm trying to deploy those reports to a development server. I have installed sql server and tools in my local machine but never configured reporting services. When I try to deploy those reports, it asks username and password for reporting services login.
But usually as far as I know, i should be able to deploy my reports without entering password etc. Even if I enter username and password, still they dont work.
Is that becase I install SQL server in my local machine?
Does anyone know why?

Thanks

View 11 Replies View Related

Can Not Deploy To Localhost

Apr 29, 2008

I am trying to deploy a project to localhost, but I get the following error. I have only one package in this project.

"Could not save the package "C:......lah.dtsx" to SQL Server "localhost".

I tried deploying other projects that I've successfully deployed before and those also fail with the same message. Am I missing something really basic here?

View 7 Replies View Related

How To Deploy Reports.

Jul 10, 2007

Hi,



I have a web project and created a setup project for it. And I have to create reports using sql server reporting services. For this I have created an reportserver project and created two reports.

I have to create a setup file to install these reports in a remote machine.

How to do this?

where this .rdl and .rds files will be stored in the reportserver.



Regards,

Murali

View 4 Replies View Related

Getting Is Not Static When Trying To Deploy

Nov 10, 2006

I'm attemping to deploy a crypto class that we use on a desktop app to SQL Server. I'll use the encryptstring/decryptstring found in this class as User Defined Functions on SQL Server. When I try to deploy the class I'm getting this error:



Error 1 Method, property or field 'EncryptString' of class 'EncryptingDecryptingOASISPWDS.Crypto' in assembly 'EncryptingDecryptingOASISPWDS' is not static. EncryptingDecryptingOASISPWDS




Here is the code:



Imports System

Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Imports Microsoft.SqlServer.Server

Imports System.Security.Cryptography

Imports System.Text 'for UnicodeEncoding

Imports System.IO 'for MemoryStream, FileStream, Stream, Path

Imports System.Threading 'for Thread.Sleep

Partial Public Class Crypto

'Private Const CodeVersion As String = "01.00.00"

'class member variables

Private m_sPassPhrase As String

'class private variables

Private mbytKey() As Byte 'crypto key

Private mbytIV() As Byte 'Initialization Vector

Private mbKeyIsSet As Boolean = False

Private mksKeyNotSetException As String = "Crypto passphrase is not set."

Private mksPassphraseTooSmall As String = "PassPhrase length must be at least {0} characters."

'--- class constructors

Public Sub New()

'no passphrase is useful for GetHashString/ValidPassword methods

End Sub

Public Sub New(ByVal CryptoPassPhrase As String)

PassPhrase = CryptoPassPhrase

End Sub

'--- class public properties

'generate and store encryption key & iv from passphrase

Public Property PassPhrase() As String

Get

Return m_sPassPhrase

End Get

Set(ByVal Value As String)

Const iMinLength As Integer = -1 '-1 disables min length

m_sPassPhrase = Value.Trim

'enforce a rule on minimum length if desired here

If (Value.Length > iMinLength) Or (iMinLength = -1) Then

Dim sha2 As New SHA256Managed()

'256 bits = 32 byte key

mbytKey = sha2.ComputeHash(BytesFromString(m_sPassPhrase))

'convert to Base64 for Initialization Vector, take last 16 chars

Dim sKey As String = Convert.ToBase64String(mbytKey)

mbytIV = Encoding.ASCII.GetBytes(sKey.Remove(0, sKey.Length - 16))

mbKeyIsSet = True

sha2 = Nothing

Else

mbKeyIsSet = False

Throw New Exception(String.Format(mksPassphraseTooSmall, (iMinLength + 1).ToString))

End If

End Set

End Property



'decrypt a stream

Public Function DecryptStream(ByVal EncryptedStream As MemoryStream) As MemoryStream

If mbKeyIsSet Then

Try

'create Crypto Service Provider, set key, transform and crypto stream

Dim oCSP As New RijndaelManaged()

oCSP.Key = mbytKey

oCSP.IV = mbytIV

Dim ct As ICryptoTransform = oCSP.CreateDecryptor()

Dim cs As CryptoStream = New CryptoStream(EncryptedStream, ct, CryptoStreamMode.Read)

'get bytes from encrypted stream

Dim byteArray(EncryptedStream.Length - 1) As Byte

Dim iBytesIn As Integer = cs.Read(byteArray, 0, EncryptedStream.Length)

cs.Close()

'create and write the decrypted output stream

Dim plainStream As New MemoryStream()

plainStream.Write(byteArray, 0, iBytesIn)

Return plainStream

Catch ex As Exception

Return Stream.Null

End Try

Else

Throw New Exception(mksKeyNotSetException)

End If

End Function

'decrypt a string - wrapper without Base64 flag (True by default)

Public Function DecryptString(ByVal EncryptedString As String) As String

Return _DecryptString(EncryptedString, True)

End Function

'decrypt a string - wrapper with Base64 flag

Public Function DecryptString(ByVal EncryptedString As String, ByVal Base64 As Boolean) As String

Return _DecryptString(EncryptedString, Base64)

End Function





'encrypt a stream

Public Function EncryptStream(ByVal PlainStream As MemoryStream) As MemoryStream

Try

'open stream for encrypted data

Dim encStream As New MemoryStream()

'create Crypto Service Provider, set key, transform and crypto stream

Dim oCSP As New RijndaelManaged()

oCSP.Key = mbytKey

oCSP.IV = mbytIV

Dim ct As ICryptoTransform = oCSP.CreateEncryptor()

Dim cs As CryptoStream = New CryptoStream(encStream, ct, CryptoStreamMode.Write)

'get input stream into byte array

Dim byteArray() As Byte = PlainStream.ToArray()

'write input bytes to crypto stream and close up

cs.Write(byteArray, 0, PlainStream.Length)

cs.FlushFinalBlock()

cs.Close()

Return encStream

Catch ex As Exception

Return Stream.Null

End Try

End Function

'encrypt a string - wrapper without Base64 flag (True by default)

<Microsoft.SqlServer.Server.SqlFunction()> _

Function EncryptString(ByVal PlainText As String) As String

Return _EncryptString(PlainText, True)

End Function

''encrypt a string - wrapper with Base64 flag

<Microsoft.SqlServer.Server.SqlFunction()> _

Public Function EncryptString2(ByVal PlainText As String, ByVal Base64 As Boolean) As String

Return _EncryptString(PlainText, Base64)

End Function

'calculates the hash of InputValue, returns a string

'- SHA1 hash is always 20 bytes (160 bits)

Public Function GetHashString(ByVal InputValue As String) As String

Try

Dim inputBytes() As Byte = BytesFromString(InputValue)

Dim hashValue() As Byte = New SHA1Managed().ComputeHash(inputBytes)

Return BytesToHexString(hashValue)

Catch ex As Exception

Return String.Empty

End Try

End Function

'returns True if hash of Passphrase matches HashValue

Public Function ValidPassword(ByVal Passphrase As String, ByVal HashValue As String) As Boolean

Return (GetHashString(Passphrase) = HashValue)

End Function





'internal string decryption

Private Function _DecryptString(ByVal EncryptedString As String, ByVal Base64 As Boolean) As String

Try

'put string in byte array depending on Base64 flag

Dim byteArray() As Byte

If Base64 Then

byteArray = Convert.FromBase64String(EncryptedString)

Else

byteArray = BytesFromString(EncryptedString)

End If

'create the streams, decrypt and return a string

Dim msEnc As New MemoryStream(byteArray)

Dim msPlain As MemoryStream = DecryptStream(msEnc)

Return BytesToString(msPlain.GetBuffer)

Catch ex As Exception

Return String.Empty

End Try

End Function



'internal string encryption

Private Function _EncryptString(ByVal PlainText As String, ByVal Base64 As Boolean) As String

Try

'put string in byte array

Dim byteArray() As Byte = BytesFromString(PlainText)

'create streams and encrypt

Dim msPlain As New MemoryStream(byteArray)

Dim msEnc As MemoryStream = EncryptStream(msPlain)

'return string depending on Base64 flag

If Base64 Then

Return Convert.ToBase64String(msEnc.ToArray)

Else

Return BytesToString(msEnc.ToArray)

End If

Catch ex As Exception

Return String.Empty

End Try

End Function

'returns a Unicode byte array from a string

Private Function BytesFromString(ByVal StringValue As String) As Byte()

Return (New UnicodeEncoding()).GetBytes(StringValue)

End Function

'returns a hex string from a byte array

Private Function BytesToHexString(ByVal byteArray() As Byte) As String

Dim sb As New StringBuilder(40)

Dim bValue As Byte

For Each bValue In byteArray

sb.AppendFormat(bValue.ToString("x2").ToUpper)

Next

Return sb.ToString

End Function

'returns a Unicode string from a byte array

Private Function BytesToString(ByVal byteArray() As Byte) As String

Return (New UnicodeEncoding()).GetString(byteArray)

End Function





'Return True when the file is available for writing

'- returns False if output file locked, for example

Private Function CheckWriteAccess(ByVal FileName As String) As Boolean

'2 second delay with 10,200

Dim iCount As Integer = 0 'retry count

Const iLimit As Integer = 10 'retries

Const iDelay As Integer = 200 'msec

While (iCount < iLimit)

Try

Dim fs As FileStream

fs = New FileStream(FileName, FileMode.Append, _

FileAccess.Write, FileShare.None)

fs.Close()

Return True

Catch ex As Exception

Thread.Sleep(iDelay)

Finally

iCount += 1

End Try

End While

Return False

End Function

End Class

View 4 Replies View Related







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