Solved

Write null to SQL Server from Access with ADO

Posted on 2012-03-29
5
403 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…

910 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

21 Experts available now in Live!

Get 1:1 Help Now