472,982 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 software developers and data experts.

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 1604

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
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
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
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
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.