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
Solved

Write null to SQL Server from Access with ADO

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

791 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