poutses
asked on
adVarChar or adLongVarChar???
I am using the following code to access a stored procedure in my database (from my VB application to my SQL Server database):
Public Function insert_News(ByVal title As Variant, _
ByVal author As Variant, _
ByVal summary As Variant, _
ByVal text As Variant) As ADODB.Recordset
On Error GoTo ErrorHandler
Set insert_News = RunSPWithRS_Null("insert_N ews", _
Array("@title", adVarChar, 255, title), _
Array("@author", adVarChar, 200, author), _
Array("@summary", adLongVarChar, 600, summary), _
Array("@text", adLongVarChar, 5000, text))
CtxSetComplete
Exit Function
ErrorHandler:
On Error Resume Next
Set insert_News = Nothing
End Function
This calls the stored procedure insert_News and passes the 4 parameters. My question is:
For the fields summary and text, should I use adVarChar or adLongVarChar? What is the limit of adVarChar and that of adLongVarChar?
What is the difference between adVarChar and adVarWChar?
Additionally, in another field which I hold currency values in Euros, and the datatype is Numeric (16,2) in the SQL Server. What should I declare the value inside my VB application when I call this stored procedure? Should I use
Array("@amount", adNumeric, 9, amount)
?
Thanks for the time
George
Public Function insert_News(ByVal title As Variant, _
ByVal author As Variant, _
ByVal summary As Variant, _
ByVal text As Variant) As ADODB.Recordset
On Error GoTo ErrorHandler
Set insert_News = RunSPWithRS_Null("insert_N
Array("@title", adVarChar, 255, title), _
Array("@author", adVarChar, 200, author), _
Array("@summary", adLongVarChar, 600, summary), _
Array("@text", adLongVarChar, 5000, text))
CtxSetComplete
Exit Function
ErrorHandler:
On Error Resume Next
Set insert_News = Nothing
End Function
This calls the stored procedure insert_News and passes the 4 parameters. My question is:
For the fields summary and text, should I use adVarChar or adLongVarChar? What is the limit of adVarChar and that of adLongVarChar?
What is the difference between adVarChar and adVarWChar?
Additionally, in another field which I hold currency values in Euros, and the datatype is Numeric (16,2) in the SQL Server. What should I declare the value inside my VB application when I call this stored procedure? Should I use
Array("@amount", adNumeric, 9, amount)
?
Thanks for the time
George
If this link:
http://www.able-consulting.com/ADODataTypeEnum.htm
Does not answer all your questions, ask.
http://www.able-consulting.com/ADODataTypeEnum.htm
Does not answer all your questions, ask.
ASKER
this partially solves my problem. It did not answer my question regarding the AdNumeric, which is the one below:
"Additionally, in another field which I hold currency values in Euros, and the datatype is Numeric (16,2) in the SQL Server. What should I declare the value inside my VB application when I call this stored procedure? Should I use
Array("@amount", adNumeric, 9, amount)"
What is the integer to add next to adNumeric? Is 9 enough, or should I make it 12, or 18?
"Additionally, in another field which I hold currency values in Euros, and the datatype is Numeric (16,2) in the SQL Server. What should I declare the value inside my VB application when I call this stored procedure? Should I use
Array("@amount", adNumeric, 9, amount)"
What is the integer to add next to adNumeric? Is 9 enough, or should I make it 12, or 18?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am sorry to insist, but how do I implement this in the following stored procedure?
Public Function ADMIN_add_creditdebit(ByVa l user_id As Variant, _
ByVal cd_name As Variant, _
ByVal cd_poso As Variant, _
ByVal cd_code As Variant) As ADODB.Recordset
On Error GoTo ErrorHandler
Set ADMIN_add_creditdebit = RunSPWithRS_Null("ADMIN_ad d_creditde bit", _
Array("@user_id", adInteger, 4, user_id), _
Array("@cd_name", adVarWChar, 255, cd_name), _
Array("@cd_poso", adNumeric, 9, cd_poso), _
Array("@cd_code", adVarWChar, 255, cd_code))
CtxSetComplete
Exit Function
ErrorHandler:
On Error Resume Next
Set ADMIN_add_creditdebit = Nothing
End Function
Thanks!
Public Function ADMIN_add_creditdebit(ByVa
ByVal cd_name As Variant, _
ByVal cd_poso As Variant, _
ByVal cd_code As Variant) As ADODB.Recordset
On Error GoTo ErrorHandler
Set ADMIN_add_creditdebit = RunSPWithRS_Null("ADMIN_ad
Array("@user_id", adInteger, 4, user_id), _
Array("@cd_name", adVarWChar, 255, cd_name), _
Array("@cd_poso", adNumeric, 9, cd_poso), _
Array("@cd_code", adVarWChar, 255, cd_code))
CtxSetComplete
Exit Function
ErrorHandler:
On Error Resume Next
Set ADMIN_add_creditdebit = Nothing
End Function
Thanks!
I am sorry, it looks like I overlooked this comment. Is this now fully resolved?
ASKER
Thanks again