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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:44:27+00:00 2026-06-06T21:44:27+00:00

i have created an app that basically looks for blob records on a mysql

  • 0

i have created an app that basically looks for blob records on a mysql server problem i have is that if for whatever reason the blob field is empty the app crashes. I thought on something like

i currently have

byte[] data = (byte[])DbReader[2];

but i was wondering if there is any way to do something like

if (DbReader.IsDbNull(2)
    byte[] data = /* DEFAULT VALUE */
else
    byte[] data = (byte[])DbReader[2];

but can i set a default value?? everything ive tried fails 🙁

  • 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-06-06T21:44:28+00:00Added an answer on June 6, 2026 at 9:44 pm

    How about this:

    byte[] data = null;
    

    Arrays are reference types so you can assign null to them. Later on you will be able see if data is null just like this:

    if(data != null)
    {
        //there is data inside that array, you can go ahead and use it.
    }
    

    EDIT: simplification

    You could simplicate your code like this:

    byte[] data = DbReader.IsDbNull(2) ? null : (byte[])DbReader[2];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have created a Blackjack app that uses several methods that get called
I have created an app that uses NSTimer, which gets triggered each second. My
I have successfully created an app that reads from a bundled .plist file and
I have created a nice icon for my app that quite accurately reproduces the
I have created a flexible navigation bar in my app that will show custom
I have created an app in C# .Net 2.0 that uses the AxShockwaveFlash object
I've created an app that shows 8 buttons in coverflow using icarousel.i have to
I have created a service class for my network connection so that my app
I have an app that recognizes an extension of a file created in my
I have a click-once deployed app that uses a notification icon created using the

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.