|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Saturday, April 27, 2013 5:33 AM
Points: 109,
Visits: 390
|
|
hello all. I use this: declare @h int,@objDBC int EXEC sp_OACreate 'ADODB.Connection', @objDBC OUT --------@objDBC =16711422 EXEC @h=sp_OASetProperty 16711422, 'ConnectionString', 'Driver={SQL Server}; Server=WIN-00UO3RQ0BM3; Database=MaliGilan; trusted_Connection=Yes' EXEC @h=sp_OAMethod 16711422, 'Open' print @h
this have to returns zero but returns -2147467259. please tell me why this dosen't return zero?
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 5:46 AM
Points: 384,
Visits: 186
|
|
Have you enabled the OA in the server? Please check this via sp_configure:
sp_configure 'show advanced options',1 GO reconfigure GO sp_configure 'Ole Automation Procedures'
You should see the run_value as 1. If not - set it to 1 and check the code one more time
Kindest Regards,
Damian Widera SQL Server MVP, MCT, MCITP-DBA, MCSD.NET
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:49 PM
Points: 6,703,
Visits: 11,733
|
|
You could also consider switching to use a Linked Server to connect to a remote SQL Server instead of using the OLE Automation routines.
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|