Article ID: 183059 - Last Review: March 2, 2005 - Revision: 2.1 PRB: ODBC Syntax Required for Retrieving Parameter InformationThis article was previously published under Q183059 On This PageSYMPTOMS
The following information only applies to the OLEDB Provider for ODBC:
When using the Refresh method on a Command object's Parameters
Collection for retrieving provider-side parameter information of a
stored procedure, parameter information may not be correct. For
example, if a stored procedure is specified in the CommandText property along with a parameter, and the parameter type is a SQL Server Text type, you will not get the correct ActiveX Data Objects (ADO) type returned for that parameter.
CAUSE
Executing the following Visual Basic code on the stored procedure
below produces the following error:
[Microsoft][ODBC SQL Server Driver]String data, right truncation
The wording of the error may vary slightly with newer versions of Microsoft Data Access Components. Visual Basic CodeNote You must change Username=<username> and PWD=<strong password> to the correct values before you run this code. Make sure that Username has the appropriate permissions to perform this operation on the database. SQL Server Stored ProcedureRESOLUTION
Executing the same procedure with the following code resolves the problem.
Note here that the CommandText uses the ODBC syntax for calling stored
procedures. The CommandType is set to adCommandText.
Code ExampleNote You must change Username=<username> and PWD=<strong password> to the correct values before you run this code. Make sure that Username has the appropriate permissions to perform this operation on the database. STATUS
This problem applies to the versions of MDAC listed above in the applies to section. This problem does not occur in the 2.5 and later versions of MDAC.
REFERENCES
For additional informationabout refreshing ADO parameters for stored procedures, click the following article number to view the article in the Microsoft Knowledge Base:
174223
(http://support.microsoft.com/kb/174223/
)
HOWTO: Refresh ADO Parameters Collection for a Stored Procedure
APPLIES TO
| Article Translations
|

Back to the top
