[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 419
  • Last Modified:

Write null to SQL Server from Access with ADO

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
lee_jd
Asked:
lee_jd
  • 3
  • 2
1 Solution
 
plummetCommented:
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
 
lee_jdAuthor Commented:
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
 
plummetCommented:
What are you writing this in? Are you using .net, c#, vb, ASP, vb6, VBA?
0
 
lee_jdAuthor Commented:
It's okay.  I sorted it with

If value 0 then parameter.value = null else parameter.value = type.value
0
 
plummetCommented:
Great, well done

Cheers
John
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now