Forum Discussion
AlexanderM
13 years agoStaff
Hi Artur,
I have replied to your support case with this question, and I will post a short summary here so that others have this information as well:
The problem with the code is that you are using ADO constants for the types. However, the CreateADOStoredProc method does not return an instance of the "ADODB.Command" object - it returns a VCL wrapper object instead. That is why the "CreateADOStoredProc Method" help topic gives a reference to VCL documentation:
The help topic gives this link to the VCL documentation:
http://docwiki.embarcadero.com/VCL/XE/en/ADODB
When using CreateADOStoredProc, you need to use the data types defined in VCL (Data.Win.ADODB.TDataType):
http://docwiki.embarcadero.com/Libraries/en/Data.Win.ADODB.TDataType
So, in your code, you should use the ftString type for your VarChar parameters - it works fine for me:
SUMMARY:
- When using ADO.CreateADOStoredProc, use the VCL data type constants:
http://docwiki.embarcadero.com/Libraries/en/Data.Win.ADODB.TDataType
- When creating an instance of the "ADODB.Command" object to invoke a stored procedure, use the ADO data type constants:
http://www.w3schools.com/ado/ado_datatypes.asp
I have replied to your support case with this question, and I will post a short summary here so that others have this information as well:
The problem with the code is that you are using ADO constants for the types. However, the CreateADOStoredProc method does not return an instance of the "ADODB.Command" object - it returns a VCL wrapper object instead. That is why the "CreateADOStoredProc Method" help topic gives a reference to VCL documentation:
The IAQAADOStoredProc object is an analogue of a Borland VCL TADOStoredProc object. Methods and properties are identical.
For detailed information on the underlying TADOStoredProc object, see VCL documentation on ADODB classes.
The help topic gives this link to the VCL documentation:
http://docwiki.embarcadero.com/VCL/XE/en/ADODB
When using CreateADOStoredProc, you need to use the data types defined in VCL (Data.Win.ADODB.TDataType):
http://docwiki.embarcadero.com/Libraries/en/Data.Win.ADODB.TDataType
So, in your code, you should use the ftString type for your VarChar parameters - it works fine for me:
Cmd["Parameters"]["Items"](0)["DataType"] = ftString;
SUMMARY:
- When using ADO.CreateADOStoredProc, use the VCL data type constants:
http://docwiki.embarcadero.com/Libraries/en/Data.Win.ADODB.TDataType
- When creating an instance of the "ADODB.Command" object to invoke a stored procedure, use the ADO data type constants:
http://www.w3schools.com/ado/ado_datatypes.asp
Related Content
- 9 months ago
Recent Discussions
- 13 hours ago