Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 54991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:18:26+00:00 2026-05-10T17:18:26+00:00

I was previously taught today how to set parameters in a SQL query in

  • 0

I was previously taught today how to set parameters in a SQL query in .NET in this answer (click).

Using parameters with values are fine, but when I try to set a field in the database to null I’m unsuccessful. Either the method thinks I am not setting a valid parameter or not specifying a parameter.

e.g.

Dim dc As New SqlCommand('UPDATE Activities SET [Limit] = @Limit WHERE [Activity] = @Activity', cn)  If actLimit.ToLower() = 'unlimited' Then     ' It's not nulling :(     dc.Parameters.Add(New SqlParameter('Limit', Nothing)) Else     dc.Parameters.Add(New SqlParameter('Limit', ProtectAgainstXSS(actLimit))) End If 

Is there something I’m missing? Am I doing it wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:18:27+00:00Added an answer on May 10, 2026 at 5:18 pm

    you want DBNull.Value.

    In my shared DAL code, I use a helper method that just does:

        foreach (IDataParameter param in cmd.Parameters)     {         if (param.Value == null) param.Value = DBNull.Value;     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have previously been using Chilkat Zip .Net to generate backup files from my
I've read a few posts on this, but there's still one thing that's not
Previously, to read XML in UTF-8 encoding through xstream, I am using DomDriver as
I previously posted this question ( Reading Google docs spreadsheet ) and got a
I previously posted here: Controlling Access for Trial Subscription Since this is a new
Was I was previously messing with Silverlight and RIA, I was using a an
I previously asked a question that I still have not been able to solve:
I previously asked a question about how to chaining exceptions in C++, and one
Suppose that we have previously instantiated three objects A, B, C from class D
I've been developing in PHP for about 8 years as a hobby. In 2009,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.