Solved

Write null to SQL Server from Access with ADO

Posted on 2012-03-29
5
402 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
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
plummet earned 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

758 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now