?
Solved

Write null to SQL Server from Access with ADO

Posted on 2012-03-29
5
Medium Priority
?
413 Views
Last Modified: 2012-03-30
I'm trying to write Null to a column in a SQL Server table that is set to take nulls.

I'm using ADO to do this in conjunction with stored procedure parameters.

I've tried setting the parameter value to VBNull and DBNull but VBNull loads 1 to the table and DBNull loads 0.

Is there a way for me to load nulls with ADO?

Thanks.
0
Comment
Question by:lee_jd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
plummet earned 1000 total points
ID: 37783624
Hi Lee_JD

If you want to pass a null value simply don't set the parameter value at all - leave it out - or you could also set it to Empty.

Hope that helps!
John
0
 
LVL 2

Author Comment

by:lee_jd
ID: 37786188
I need to overwrite the value in the database with Null so not setting a value is not an option.  Also setting the value to Nothing doesn't work either.
0
 
LVL 10

Expert Comment

by:plummet
ID: 37786329
What are you writing this in? Are you using .net, c#, vb, ASP, vb6, VBA?
0
 
LVL 2

Author Comment

by:lee_jd
ID: 37786341
It's okay.  I sorted it with

If value 0 then parameter.value = null else parameter.value = type.value
0
 
LVL 10

Expert Comment

by:plummet
ID: 37786406
Great, well done

Cheers
John
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question