NULL ADO Parameter

Surely this has been done in the past.

I need to sometimes assign a NULL value to an ADO Parameter for supply to a parameterized query ... which is the best available routine to solve this?

TIA
santosh_14Asked:
Who is Participating?
 
daffyduck14milConnect With a Mentor Commented:
Dim cmCommand as Adodb.command

set cmCommand = new Adodb.command
With cmCommand
  .ActiveConnection = g_cnConnection
  .CommandType = adCmdStoredProc
  .CommandText = "sp_insert_user"
  ' [REDO] Use .Parameters.Append .CreateParameter
  ' if you need more speed.
  .Parameters.Refresh
  ' Either leave this out, and call the command,
  ' or set the value.
  .Parameters("@Username").value = Null
  .Execute
end with

Grtz.©

D.
0
 
Anthony PerkinsCommented:
I suppose there is no sense in reminding you to close your open questions, is there?  For the record:

Questions Asked 55
Last 10 Grades Given A A A A A A A A A A  
Question Grading Record 48 Answers Graded / 48 Answers Received

Anthony
0
 
smeggheadCommented:
Or, you could just omit the parameter and give the parameter within the SP a default value of null.

This also keeps the definition of the SP more consistant, i.e. So that you can see which parameters are optional.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
daffyduck14milCommented:
Santosh,

Are you going to attend to this question? Given your record not, but i'll wait a few days...

Grtz.©

D.
0
 
santosh_14Author Commented:
Checked my old email account today .. thx
0
 
daffyduck14milCommented:
Great, hope you have your solution.

Grtz.©

D.
0
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.

All Courses

From novice to tech pro — start learning today.