Showing posts with label ole. Show all posts
Showing posts with label ole. Show all posts

Tuesday, March 27, 2012

Can't change the name of a OLE DB Source component name

Hi,

I've created an application that create package with a dataflow. The package with the dataflow and the ole db Source was created succesfully but for some reason the name of the Ole DB Source dosen't change programmitcally It's stays with the default name "OLE DB Source". This is very problematic because I want to add another Ole Db source and the package won't load because there will be two components with the same name.

Thanks.

This is the Code, It's from msdn exmples:

Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports Microsoft.SqlServer.Dts.Pipeline
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Module Module1

Sub Main()

Dim package As Microsoft.SqlServer.Dts.Runtime.Package = _
New Microsoft.SqlServer.Dts.Runtime.Package()
Dim e As Executable = package.Executables.Add("DTS.Pipeline.1")
Dim thMainPipe As Microsoft.SqlServer.Dts.Runtime.TaskHost = _
CType(e, Microsoft.SqlServer.Dts.Runtime.TaskHost)
Dim dataFlowTask As MainPipe = CType(thMainPipe.InnerObject, MainPipe)

' Add an OLEDB connection manager to the package.
Dim cm As ConnectionManager = package.Connections.Add("OLEDB")
cm.Name = "OLEDB ConnectionManager"
cm.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=AdventureWorks;Provider=SQLOLEDB.1;" & _
"Integrated Security=SSPI;"

' Add an OLE DB source to the data flow.
Dim component As IDTSComponentMetaData90 = _
dataFlowTask.ComponentMetaDataCollection.New()
component.Name = "AdventureWorks;Product"
component.ComponentClassID = "DTSAdapter.OleDbSource.1"
' You can also use the CLSID of the component instead of the PROGID.
'component.ComponentClassID = "{2C0A8BE5-1EDC-4353-A0EF-B778599C65A0}";

' Get the design time instance of the component.
Dim instance As CManagedComponentWrapper = component.Instantiate()

' Initialize the component.
instance.ProvideComponentProperties()

' Specify the connection manager.
If component.RuntimeConnectionCollection.Count > 0 Then
component.RuntimeConnectionCollection(0).ConnectionManager = _
DtsConvert.ToConnectionManager90(package.Connections(0))
End If

' Set the custom properties.
instance.SetComponentProperty("AccessMode", 2)
instance.SetComponentProperty("SqlCommand", _
"Select * from Production.Product")

' Reinitialize the metadata.
instance.AcquireConnections(vbNull)
instance.ReinitializeMetaData()
instance.ReleaseConnections()

' Add other components to the data flow and connect them.

End Sub

End Module

If I remember correctly, the Name should be set after the call to

instance.ProvideComponentProperties();

|||Thanks It works

Friday, February 10, 2012

Cannot restore database

RESTORE DATABASE upperbridge
FROM DISK = C:\...........
WITH REPLACE
gets the error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be
obtained because the database is in use.
This is on my test SQL Server 2000 on my intranet with no other users. Both
Enterprise Manager and Query Analyser are not running.
Please advise.
Seems like someone has a connection to the database. Make sure that the connection from where you do the
restore isn't in the database. Check who is in the database using sp_who or sp_who2.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
> RESTORE DATABASE upperbridge
> FROM DISK = C:\...........
> WITH REPLACE
> gets the error
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be
> obtained because the database is in use.
> This is on my test SQL Server 2000 on my intranet with no other users. Both
> Enterprise Manager and Query Analyser are not running.
> Please advise.
>
>
|||Run sp_who or sp_who2 and see who is connected to it.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
RESTORE DATABASE upperbridge
FROM DISK = C:\...........
WITH REPLACE
gets the error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be
obtained because the database is in use.
This is on my test SQL Server 2000 on my intranet with no other users. Both
Enterprise Manager and Query Analyser are not running.
Please advise.
|||Are you sure that the QA session you're using to restore the database isn't
the one that's using the database? Use sp_who2 to see who's using it.
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
RESTORE DATABASE upperbridge
FROM DISK = C:\...........
WITH REPLACE
gets the error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be
obtained because the database is in use.
This is on my test SQL Server 2000 on my intranet with no other users. Both
Enterprise Manager and Query Analyser are not running.
Please advise.
|||Hi Roger,
Execute the below script from master to restore the database (Execute all
the lines in a together from query analyzer - Replace dbname , filename ,
directory and
logical name based on ur requirement)
use master
go
alter database <dbname> set single_user with rollback immediate
go
restore database <dbname> from disk = 'C:\filename.bak' with recovery,
move 'logical_mdf_name' to 'c:\mssql\data\filename.mdf',
move 'logical_ldf_name' to 'c:\mssql\data\filename.ldf'
Thanks
Hari
MCDBA
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
> RESTORE DATABASE upperbridge
> FROM DISK = C:\...........
> WITH REPLACE
> gets the error
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not
be
> obtained because the database is in use.
> This is on my test SQL Server 2000 on my intranet with no other users.
Both
> Enterprise Manager and Query Analyser are not running.
> Please advise.
>
>

Cannot restore database

RESTORE DATABASE upperbridge
FROM DISK = C:\...........
WITH REPLACE
gets the error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be
obtained because the database is in use.
This is on my test SQL Server 2000 on my intranet with no other users. Both
Enterprise Manager and Query Analyser are not running.
Please advise.Run sp_who or sp_who2 and see who is connected to it.
--
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
RESTORE DATABASE upperbridge
FROM DISK = C:\...........
WITH REPLACE
gets the error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be
obtained because the database is in use.
This is on my test SQL Server 2000 on my intranet with no other users. Both
Enterprise Manager and Query Analyser are not running.
Please advise.|||Seems like someone has a connection to the database. Make sure that the connection from where you do the
restore isn't in the database. Check who is in the database using sp_who or sp_who2.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
> RESTORE DATABASE upperbridge
> FROM DISK = C:\...........
> WITH REPLACE
> gets the error
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be
> obtained because the database is in use.
> This is on my test SQL Server 2000 on my intranet with no other users. Both
> Enterprise Manager and Query Analyser are not running.
> Please advise.
>
>|||Are you sure that the QA session you're using to restore the database isn't
the one that's using the database? Use sp_who2 to see who's using it.
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
RESTORE DATABASE upperbridge
FROM DISK = C:\...........
WITH REPLACE
gets the error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not be
obtained because the database is in use.
This is on my test SQL Server 2000 on my intranet with no other users. Both
Enterprise Manager and Query Analyser are not running.
Please advise.|||Hi Roger,
Execute the below script from master to restore the database (Execute all
the lines in a together from query analyzer - Replace dbname , filename ,
directory and
logical name based on ur requirement)
use master
go
alter database <dbname> set single_user with rollback immediate
go
restore database <dbname> from disk = 'C:\filename.bak' with recovery,
move 'logical_mdf_name' to 'c:\mssql\data\filename.mdf',
move 'logical_ldf_name' to 'c:\mssql\data\filename.ldf'
Thanks
Hari
MCDBA
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
> RESTORE DATABASE upperbridge
> FROM DISK = C:\...........
> WITH REPLACE
> gets the error
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could not
be
> obtained because the database is in use.
> This is on my test SQL Server 2000 on my intranet with no other users.
Both
> Enterprise Manager and Query Analyser are not running.
> Please advise.
>
>

Cannot restore database

RESTORE DATABASE upperbridge
FROM DISK = C:\...........
WITH REPLACE
gets the error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access
could not be
obtained because the database is in use.
This is on my test SQL Server 2000 on my intranet with no other users. Both
Enterprise Manager and Query Analyser are not running.
Please advise.Seems like someone has a connection to the database. Make sure that the conn
ection from where you do the
restore isn't in the database. Check who is in the database using sp_who or
sp_who2.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
> RESTORE DATABASE upperbridge
> FROM DISK = C:\...........
> WITH REPLACE
> gets the error
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive acces
s could not be
> obtained because the database is in use.
> This is on my test SQL Server 2000 on my intranet with no other users. Bo
th
> Enterprise Manager and Query Analyser are not running.
> Please advise.
>
>|||Run sp_who or sp_who2 and see who is connected to it.
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
RESTORE DATABASE upperbridge
FROM DISK = C:\...........
WITH REPLACE
gets the error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access
could not be
obtained because the database is in use.
This is on my test SQL Server 2000 on my intranet with no other users. Both
Enterprise Manager and Query Analyser are not running.
Please advise.|||Are you sure that the QA session you're using to restore the database isn't
the one that's using the database? Use sp_who2 to see who's using it.
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
RESTORE DATABASE upperbridge
FROM DISK = C:\...........
WITH REPLACE
gets the error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access
could not be
obtained because the database is in use.
This is on my test SQL Server 2000 on my intranet with no other users. Both
Enterprise Manager and Query Analyser are not running.
Please advise.|||Hi Roger,
Execute the below script from master to restore the database (Execute all
the lines in a together from query analyzer - Replace dbname , filename ,
directory and
logical name based on ur requirement)
use master
go
alter database <dbname> set single_user with rollback immediate
go
restore database <dbname> from disk = 'C:\filename.bak' with recovery,
move 'logical_mdf_name' to 'c:\mssql\data\filename.mdf',
move 'logical_ldf_name' to 'c:\mssql\data\filename.ldf'
Thanks
Hari
MCDBA
"Roger Withnell" <rogerREMOVE@.THISFIRSTupperbridge.co.uk> wrote in message
news:c9g2ap$s9f$1@.hercules.btinternet.com...
> RESTORE DATABASE upperbridge
> FROM DISK = C:\...........
> WITH REPLACE
> gets the error
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could
not
be
> obtained because the database is in use.
> This is on my test SQL Server 2000 on my intranet with no other users.
Both
> Enterprise Manager and Query Analyser are not running.
> Please advise.
>
>