Solved

NULL ADO Parameter

Posted on 2002-05-31
6
628 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
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now