Friday, March 23, 2012

How can I pass NULL to a parameter

How can I pass NULL to a parameter, if now entry is made in the textbox?

Dim KeywordParamAsNew SqlParameter("@.Keyword",Me.KeyWordText.Text)

MyCommand.Parameters.Add(KeywordParam)

Hi

You could try something like this:

If (Me.KeyWordText.Text="")Then cmd.Parameters("@.Keyword").Value = DBNull.ValueElse cmd.Parameters("@.Keyword").Value =Me.KeyWordText.Text
End If

No comments:

Post a Comment