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_News", _
            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
poutsesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

poutsesAuthor Commented:
Just to let you know, I am using nvarchar and ntext in my database. Should I be using adVarWChar and adLongVarWChar instead of what I am using now?

Thanks again
0
Anthony PerkinsCommented:
If this link:
http://www.able-consulting.com/ADODataTypeEnum.htm

Does not answer all your questions, ask.
0
poutsesAuthor Commented:
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?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Anthony PerkinsCommented:
9 is the size in bytes and that covers anything up to a numeric of precision of 18.  However, in order to pass that parameter to a stored procedure you will also have to set the precision (18) and the scale (2).  Typically this is done as follows:
cmd.Parameters("@NumericParameter").Precision = 18
cmd.Parameters("@NumericParameter").NumericScale = 2
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
poutsesAuthor Commented:
I am sorry to insist, but how do I implement this in the following stored procedure?

Public Function ADMIN_add_creditdebit(ByVal 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_add_creditdebit", _
            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!
0
Anthony PerkinsCommented:
I am sorry, it looks like I overlooked this comment.  Is this now fully resolved?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.