473,498 Members | 1,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

initialising Properties correctly

i use a class for all by database actions, the class has the following
properties
Private m_intDrugid As Integer
Private m_intInumber As Integer
Private m_intEnumber As Integer
Private m_strDrugname As String
Private m_strDoseage As String

i'm having problems when i assign all of the values in the properties to a
method that inserts a record in a Oracle(7) table via a stored proc

not all of the values need to be populated, i.e. they can be Nulls. problem
is. how do i set them to Null so that the it will insert the record
correctly. if i populate all the properties the method will fire
sucessfully.

is there a way to initialise them to the correct Null so to speak

Cheers,
Craig
Nov 19 '05 #1
1 781
Craig:

You can assign Nothing to a String field to represent null, but it's
not possible to assign Nothing to a value type like an Integer. If you
need a nullable field you might need to make the field type Object, or
wrap an Integer inside of a new class.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Tue, 7 Dec 2004 14:42:56 -0000, "Craig G"
<cr**********@yarrasoftware.com> wrote:
i use a class for all by database actions, the class has the following
properties
Private m_intDrugid As Integer
Private m_intInumber As Integer
Private m_intEnumber As Integer
Private m_strDrugname As String
Private m_strDoseage As String

i'm having problems when i assign all of the values in the properties to a
method that inserts a record in a Oracle(7) table via a stored proc

not all of the values need to be populated, i.e. they can be Nulls. problem
is. how do i set them to Null so that the it will insert the record
correctly. if i populate all the properties the method will fire
sucessfully.

is there a way to initialise them to the correct Null so to speak

Cheers,
Craig


Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2614
by: Nick Keighley | last post by:
Hi, is there a way of initialising a vector in a similar fashion to initialising an array? consider: Shape* triangle = new Triangle (); Shape* square = new Square (); Shape* shape_arr =...
7
2209
by: Mike P | last post by:
I have a class with a dozen+ properties, some of which will be set a value, and some not, depending on the constructor called. I also have a method which has only one overload and all of the...
2
3154
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
47
467
by: Jon Slaughter | last post by:
private string name; public string Name { get { return name; } set { name = value; } } In the above, why doesn't C# just allow one to create a single directive to make a property?
107
4031
by: DaveC | last post by:
I always used to initialise variables at declaration, then a couple of colleagues started telling me it was bad practice and that the compiler should be left to spot the use of uninitilised...
2
2070
by: Christoph Conrad | last post by:
Hi, given the following test case, with CString from Microsofts MFC: ================================================== file 1: CString arr; ...
3
2108
by: Jeremy | last post by:
I've created a serializable class and put attributes around all the properties that should be serialized. I return the class from a web service, but my problem is that the wsdl for the web service...
32
11362
by: Simon L | last post by:
BOOL bMyarray; memset(bMyArray , 0xFF, sizeof(BOOL) * 1000); clean & quick until someone else's code found I was returning -1 to mean true Because my BOOL is 4 bytes long, TRUE in memory...
26
1738
by: optimistx | last post by:
A variable in global scope var a1 = 'contents of global variable a1'; can be references (with some limitations) as window; // or window.a1; // or even window;
0
7124
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6998
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.