How to pass NULL or empty strings to stored procedure input parameter with ADO and VB?

后端 未结 3 628
既然无缘
既然无缘 2021-01-05 03:22

I have a stored procedure in Sql Server 2005 with a varchar input parameter defined as:

@Value varchar(24) = NULL

in my VB6 application I t

3条回答
  •  迷失自我
    2021-01-05 03:50

    if you want to pass a blank string to a parameter us adBSTR instead of adVarChar. It works for strings longer than zero chars too

    eg (where oCmd is the command object in question):

    oCmd.Parameters.Append oCmd.CreateParameter("@Parm", adBSTR, adParamInput, len(sParm), sParm)
    

提交回复
热议问题