hacmonev
14-03-2010, 11:15
Mình có vấn đè cần hỏi về sử dụng file .dll (assembly). Làm cách nào để có thể load hoặc insert file .dll vào DB của SQL Server 2005?
Khi mình dùng lệnh CREATE ASSEMBLY như sau:
SET ANSI_NULLS on
set QUOTED_IDENTIFIER ON
use myQLCV
create assembly importDLL from 'D:\setup\Database QLCV\myDLL.dll' with permission_set = unsafe
thì SQL báo ra lỗi:
Assembly 'myDLL' references assembly 'system.windows.forms, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
Theo mình hiểu thì SQL yêu cầu có file assembly trong phàn Assemblies của nó, khi mình add bằng SQL Programability/Assemblies/New assembly/Path to assembly thì lại fun ra lỗi:
===================================
Create failed for SqlAssembly 'myDLL'. (Microsoft.SqlServer.Smo)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.Exceptio nTemplates.FailedOperationExceptionText&EvtID=Create+SqlAssembly&LinkId=20476
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.Cr eateImpl()
at Microsoft.SqlServer.Management.Smo.SqlAssembly.Cre ate(String[] assemblyLocalPaths)
at Microsoft.SqlServer.Management.SqlManagerUI.Assemb lyPropertiesData.AssemblyPrototype.ApplyChanges(Da tabase database)
at Microsoft.SqlServer.Management.SqlManagerUI.Assemb lyPropertiesGeneral.OnRunNow(Object sender)
at Microsoft.SqlServer.Management.SqlMgmt.PanelExecut ionHandler.Run(RunType runType, Object sender)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTree ViewControl.DoPreProces***ecutionAndRunViews(RunTy pe runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTree ViewControl.ExecuteForSql(PreProces***ecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTree ViewControl.Microsoft.SqlServer.Management.SqlMgmt .IExecutionAwareSqlControlCollection.PreProces***e cution(PreProces***ecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitche rControlsManager.
Thực sự mình đã search google rất nhiều, nhưng chưa có tìm được giải pháp.
Rất mong có sự giúp đỡ của các bạn
[=========> Bổ sung bài viết <=========]
không một ai có ý kiến gì ư T_T :((:((:((
Khi mình dùng lệnh CREATE ASSEMBLY như sau:
SET ANSI_NULLS on
set QUOTED_IDENTIFIER ON
use myQLCV
create assembly importDLL from 'D:\setup\Database QLCV\myDLL.dll' with permission_set = unsafe
thì SQL báo ra lỗi:
Assembly 'myDLL' references assembly 'system.windows.forms, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
Theo mình hiểu thì SQL yêu cầu có file assembly trong phàn Assemblies của nó, khi mình add bằng SQL Programability/Assemblies/New assembly/Path to assembly thì lại fun ra lỗi:
===================================
Create failed for SqlAssembly 'myDLL'. (Microsoft.SqlServer.Smo)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.Exceptio nTemplates.FailedOperationExceptionText&EvtID=Create+SqlAssembly&LinkId=20476
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.Cr eateImpl()
at Microsoft.SqlServer.Management.Smo.SqlAssembly.Cre ate(String[] assemblyLocalPaths)
at Microsoft.SqlServer.Management.SqlManagerUI.Assemb lyPropertiesData.AssemblyPrototype.ApplyChanges(Da tabase database)
at Microsoft.SqlServer.Management.SqlManagerUI.Assemb lyPropertiesGeneral.OnRunNow(Object sender)
at Microsoft.SqlServer.Management.SqlMgmt.PanelExecut ionHandler.Run(RunType runType, Object sender)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTree ViewControl.DoPreProces***ecutionAndRunViews(RunTy pe runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTree ViewControl.ExecuteForSql(PreProces***ecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTree ViewControl.Microsoft.SqlServer.Management.SqlMgmt .IExecutionAwareSqlControlCollection.PreProces***e cution(PreProces***ecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitche rControlsManager.
Thực sự mình đã search google rất nhiều, nhưng chưa có tìm được giải pháp.
Rất mong có sự giúp đỡ của các bạn
[=========> Bổ sung bài viết <=========]
không một ai có ý kiến gì ư T_T :((:((:((