Solved

How to set Null value in ADO Parameter

Posted on 2002-06-28
3
531 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
Comment Utility
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
Comment Utility
Thanks! That worked.
0
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
glad i could help, thanks for the grade
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
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 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…

744 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

17 Experts available now in Live!

Get 1:1 Help Now