?
Solved

How to set Null value in ADO Parameter

Posted on 2002-06-28
3
Medium Priority
?
554 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
[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
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 800 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

Industry Leaders: 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!

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Suggested Courses
Course of the Month10 days, 6 hours left to enroll

765 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