With ADODBCmd
.ActiveConnection = ADODBConn
.Prepared = True
.CommandType = CommandTypeEnum.adCmdStoredProc
.NamedParameters = True
.CommandText = Sql_GetMyBook
.Parameters.Append(.CreateParameter("@book", DataTypeEnum.adChar, ParameterDirectionEnum.adParamInput, 50, MyBook))
End With
我得到一个投射错误……
System.Exception was unhandled Message=System.InvalidCastException: Unable to cast COM object of type ‘System.__ComObject’ to class type ‘ADODB.InternalParameter’. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
ALTER PROCEDURE [dbo].[GetMybook]
-- Add the parameters for the stored procedure here
@book char(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT BookTitle, Author, PulishedDate
FROM Library
WHERE BookTitle=@book
Microsoft ActiveX数据对象库中“.CreateParameter”方法的返回值之间存在差异(无意或无意)
With ADODBCmd
.ActiveConnection = ADODBConn
.Prepared = True
.CommandType = CommandTypeEnum.adCmdStoredProc
.NamedParameters = True
.CommandText = Sql_GetMyBook
.Parameters.Append(.CreateParameter("@book", DataTypeEnum.adChar, ParameterDirectionEnum.adParamInput, 50, MyBook))
End With
我得到一个投射错误……
System.Exception was unhandled Message=System.InvalidCastException: Unable to cast COM object of type ‘System.__ComObject’ to class type ‘ADODB.InternalParameter’. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
ALTER PROCEDURE [dbo].[GetMybook]
-- Add the parameters for the stored procedure here
@book char(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT BookTitle, Author, PulishedDate
FROM Library
WHERE BookTitle=@book
Microsoft ActiveX数据对象库中“.CreateParameter”方法的返回值之间存在差异(无意或无意)