473,508 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Null Value Error when Inserting record

Hello all,

I have an SQL Insert statement I'm trying to run via ExecuteNonQuery. It
works fine so long as there are no nulls values. Here is the
statement...(its a shortened version of what i actually have)

MySQL = "Insert into Activity (ActivityName) Values ('" + GetString(2) + "')";
Here is the JIT Error..."Data is Null. This method or property cannot be
called on Null Values"

I'm assuming I have to use the ISDBNull method, but don't understand how to
use it when the field contains a null value. Or should I say, how do I make
it so that the INSERT statement completes and stores the null value?

Now, I do want to be able to insert null values and that is where I am
confused. I don't understand how the ISDBNULL will allow me to do that. I
double checked and in SQL Server the field is set to allow nulls. So I'
don't know what to try next.

Any help would be appreciated.

--
TIA,
Jeff Reed
Nov 17 '05 #1
1 1661

Jeff wrote:
I have an SQL Insert statement I'm trying to run via ExecuteNonQuery. It
works fine so long as there are no nulls values. Here is the
statement...(its a shortened version of what i actually have)

MySQL = "Insert into Activity (ActivityName) Values ('" + GetString(2) + "')";
Here is the JIT Error..."Data is Null. This method or property cannot be
called on Null Values"

I'm assuming I have to use the ISDBNull method, but don't understand how to
use it when the field contains a null value. Or should I say, how do I make
it so that the INSERT statement completes and stores the null value?

Now, I do want to be able to insert null values and that is where I am
confused. I don't understand how the ISDBNULL will allow me to do that. I
double checked and in SQL Server the field is set to allow nulls. So I'
don't know what to try next.


Nov 17 '05 #2

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

Similar topics

7
1374
by: Agnes | last post by:
In my table, the datafield set to be 'allownull', However, I want to set it as blank but not null. Should I put a space in the default value in sql database ? or, During inserting record, I...
10
2908
by: Rahul Babbar | last post by:
Hi, I am getting the following error, while executing the simple insert script on a few tables. INSERT INTO <table_name>(<col1>) VALUES (1); DB2 SQL error: SQLCODE: -440, SQLSTATE: 42884,...
2
2408
by: preeti13 | last post by:
Hi guys i am here with my another probelm please help me.trying insert the value into the data base but getting the null value error .I am getting thsi error Cannot insert the value NULL into...
9
1737
by: KDawg44 | last post by:
Hi, I have PHP function that adds a record to the database. The table has an ID that is AUTO_INCREMENT. Is there anyway to get that ID back when I do any kind of insert? That ID is a foreign...
0
7135
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
7067
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
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5650
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
5060
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
4729
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
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
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 ...
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.