473,669 Members | 2,466 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...(it s 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 1668

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...(it s 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
1384
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 replace the field with ' ' when it is null ?? Thanks
10
2921
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, SQLERRMC: =;FUNCTION Message: No authorized routine named "=" of type "FUNCTION" having compatible arguments was found.
2
2423
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 column 'EmployeeID', table 'Accomplishments.dbo.Accomplishment'; column does not allow nulls. INSERT fails. The statement has been terminated. and my code is this using System; using System.Collections;
9
1746
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 key that I need to do an insert on afterwards. Thanks. Kevin
0
8895
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8809
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7407
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6210
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4206
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4386
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2797
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 we have to send another system
2
2032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1788
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.