Solved

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

Posted on 2006-10-24
7
1,167 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi: how to implement a User Shortcut mapper? 1 109
When I am typing into a TEdit last word repeats 7 129
CheckListBox usage 3 58
Delphi: sending SMS on android platform 1 18
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

785 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