Solved

NULL ADO Parameter

Posted on 2002-05-31
6
641 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:santosh_14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Accepted Solution

by:
daffyduck14mil earned 50 total points
ID: 7046485
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7047489
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
 
LVL 10

Expert Comment

by:smegghead
ID: 7048060
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:daffyduck14mil
ID: 7055769
Santosh,

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

Grtz.©

D.
0
 

Author Comment

by:santosh_14
ID: 7074989
Checked my old email account today .. thx
0
 
LVL 3

Expert Comment

by:daffyduck14mil
ID: 7074993
Great, hope you have your solution.

Grtz.©

D.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question