473,385 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Adding a DBNull value to the database

I have a table (jobs) where a field (email) is defined as varchar(50) and
can be set to null. How do I do that? For example, I have an OleDbCommand
called cmdSub and I perform the following:

cmdSub.CommandText =
"INSERT INTO jobs " +
"([Company Name], [Position Title], [Position Contact Information],
[Position Description], discipline_id, City, state_id, posted, email) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)\n";

And then for the last parameter do

cmdSub.Parameters.Add("email", DBNull.Value);

But I end up with a field filled with spaces. What am I doing wrong?
Nov 17 '05 #1
0 1056

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

Similar topics

10
by: Eric Petruzzelli | last post by:
If I fill my dataset and there is no data. The dataset is still created with zero rows (all columns are there). When I add my first row using the script below, it takes over 2 seconds to add??? If...
2
by: Viorel | last post by:
Adding new row with default values. In order to insert programmatically a new row into a database table, without direct "INSERT INTO" SQL statement, I use the well-known DataTable.NewRow,...
11
by: Patrick.O.Ige | last post by:
When i try and use this (Where Unit is a column in my Table):- If Unit Is DBNull.Value Then Return "1" Else Return "2" End If I always have 2 returned! Even when Unit is NULL! I want a...
4
by: Dursun | last post by:
Hi, I am trying to assign NULL to a datetime field in the SQL Server database. Here is the code that does NOT work: INSERT INTO ... .... VALUES ... .... CType(IIf(dateWitness2Date.Checked,...
3
by: Larry | last post by:
Hi all, I am coming over from VB 6, learning VB.NET. I have read and have in front of me, the language reference from the msdn, on; Behavior of Null has changed, Isdbnull function and...
6
by: Charlie Brown | last post by:
When checking for NULL values from a database, normally I would use If Not row("NetSales") Is DBNull.Value Then NetSales = row("NetSales") End If However, if I use a typed dataset then I...
19
by: Dave | last post by:
If Iwant to check if dataset1.SelectQuery1.column1 == System.DBNull.Value. How do I do this? What I wrote above will give an error. -- L. A. Jones
3
by: Finn Stampe Mikkelsen | last post by:
Hi I have defined a table in my database, with 2 date-fields. I have set a default value to DBNull. I have integrated a nullable datetimepicker control to my project and set the apropriate...
3
by: shlabadoo | last post by:
Hello, I searched for quite a while for an answer to this, but with no joy. All the answeres seem to be how to deal with getting a DBNull value out of a database, not to put it in . Perhaps I am...
3
by: John | last post by:
Hi What is the difference between Nothing and dbnull.value? Thanks Regards
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.