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 6061931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:59:36+00:00 2026-05-23T08:59:36+00:00

I have a line that is giving an error: Type of conditional expression cannot

  • 0

I have a line that is giving an error:
Type of conditional expression cannot be determined because there is no implicit conversion between ‘string’ and ‘int’

param[0].Value = form_request_id == null ? DBNull.Value.ToString() : form_request_id; 

however, form_request_id is an int

How do I check for nulls in an int data type?

  • 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. Editorial Team
    Editorial Team
    2026-05-23T08:59:36+00:00Added an answer on May 23, 2026 at 8:59 am

    Your immediate problem isn’t that you’re checking for nulls in form_request_id (which will actually always evaluate to false since you really need to use an int? for the value to actually be null).

    The real problem is that both sides of your conditional expression return different types (one is string and the other is int).

    Since the param[0].Value should really be different types based on the condition…you’re not going to be able to use the shortcut statement here. You’ll have to spell it out the long way:

    if(form_request_id == null)
        param[0].Value = DBNull.Value;
    else
        param[0].Value = form_request_id;
    

    As I mentioned before, you still need to use int? rather than int so that your variable can appropriately hold a null value. When you do that, you shouldn’t even need the statement anymore because the database provider will see a null value and substitute DBNull.Value for you behind the scenes. The code would simply be:

    param[0].Value = form_request_id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a line of code that gets the following error when run through
A have a XML helper that is giving the error: NoMethodError in Admin/xml#index Showing
I have a line that I draw in a window and I let the
I have a line chart that is updated every so and so seconds, similar
I have this line below that shows a link to go the next page
I have a command line that I'm trying to modify to remove some of
i have a jQuery line that execute 2 animations, what i want is to
I have a command line executable that alters some bits in a file that
I have a multi-line string that I want to do an operation on each
I have a command-line utility that gets quite a bit of downloads from my

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.