Solved

Assign Nil-Value to a TADOStoredProc-Parameter ...

Posted on 2006-10-24
7
1,190 Views
Last Modified: 2012-06-22
Hi,

Environment:
  - Delphi 5 Enterprise Edition on Windows XP machines.
  - SQL Server 2000 (on Windows 2000).



I wonder if there is a way to explicitly set the value of a Stored Procedure Parameter to a NULL (NIL) Value from code.

So it should be something like :
spMyStoredProc.Parameters.ParamByName('Param1').Value := nil; // Does not compile !!

Then I get compilation-error : incompatible type Variant and Pointer.

Anybody any idea how to solve/work around this problem ?

Best regards,

The Mayor.
0
Comment
Question by:wimmeyvaert
[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
  • 4
  • 2
7 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 17794322
try varnull
0
 
LVL 6

Author Comment

by:wimmeyvaert
ID: 17794346
Does'nt seem to work.

BUT !!!!!

I found a solution myself :

spMyStoredProc.Parameters.ParamByName('Param1').Value := UnAssigned;

Simple as that !!

Is it for you OK if I ask EE to refund my points ?
0
 
LVL 6

Author Comment

by:wimmeyvaert
ID: 17794350
Found my solution on : http://www.martinstoeckli.ch/delphi/delphi.html
Section 'Variants and COM'
0
Technology Partners: 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!

 
LVL 6

Author Comment

by:wimmeyvaert
ID: 17794414
I tried following possibilities :

spMyStoredProc.Parameters.ParamByName('Param1').Value := varNull; //-> NOK
spMyStoredProc.Parameters.ParamByName('Param1').Value := varEmpty; // -> NOK
spMyStoredProc.Parameters.ParamByName('Param1').Value := UnAssigned; // -> OK !

So, the only working possibility in my case is to use 'UnAssigned'.
0
 
LVL 28

Expert Comment

by:2266180
ID: 17794419
> Is it for you OK if I ask EE to refund my points ?
it is very ok. it is actually the thing to do when you find the answer yourself ;)
0
 
LVL 6

Author Comment

by:wimmeyvaert
ID: 17795052
OK, thanks for the understanding.

I'll ask for a refund then.

Best regards and keep up the good work,

The Mayor.
0
 
LVL 1

Accepted Solution

by:
kodiakbear earned 0 total points
ID: 17800258
Closed, 50 points refunded.
kb
Experts Exchange Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

752 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