Adding a DBNull value to the database

B

Boris Zakharin

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top