Solved

How to set Null value in ADO Parameter

Posted on 2002-06-28
3
535 Views
Last Modified: 2012-05-04
Using VB6 and ADO - how do you set a paramater value as Null. The parameter is an input parameter to a stored procedure call?
0
Comment
Question by:mdwyer
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 200 total points
ID: 7116710
Hi mdwyer,

this is from MS Develop Support

Private Sub Command1_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim pm As ADODB.Parameter

cn.Open "Provider=SQLOLEDB;Data Source=....."
Set cmd.ActiveConnection = cn
cmd.CommandText = "insert into [description] values(?)"
cmd.CommandType = adCmdText

Set pm = cmd.CreateParameter("@value", adBSTR, adParamInput, 50)
pm.Value = Null

cmd.Parameters.Append pm
cmd.Execute
cn.Close

End Sub

HAGD:O)Bruintje
0
 

Author Comment

by:mdwyer
ID: 7116985
Thanks! That worked.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7117002
glad i could help, thanks for the grade
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

770 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