Solved

Insert Null into sql??

Posted on 2003-12-04
1
517 Views
Last Modified: 2012-05-04
Hey so I have a sql insert string we'll say:
Insert INTO FooTable (val1,val2,val3) values (@val1,@val2,@val3)

I go through and add the parameters.
Now when adding the values, that can depend on what is read by the application. The problem is if the value is null.
if it is null I want to have the database be null. But the requirement for this null changed from when I originally built the app, so I can't have it dynamically create the string. Basically I want to know if I can have the value = null?

0
Comment
Question by:jj819430
1 Comment
 
LVL 18

Accepted Solution

by:
testn earned 500 total points
ID: 9876705
Just set the parameter to DBNull.Value
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 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

20 Experts available now in Live!

Get 1:1 Help Now