Solved

How to set Null value in ADO Parameter

Posted on 2002-06-28
3
540 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

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

856 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