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

  • Home
  • SEARCH
  • 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 8499445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:40:09+00:00 2026-06-11T00:40:09+00:00

I have a query in a TableAdapter that wrapped this SQL (Oracle SQL, uses

  • 0

I have a query in a TableAdapter that wrapped this SQL (Oracle SQL, uses ‘:’ instead of ‘@’ for parameterized variable), which I called GetModel()

SELECT MFG_PRODUCT FROM FRAME_NO
WHERE FRM_NO = :FRM_NO

I expected the query might return null values, so I set the column MFG_PRODUCT null value to be Null as pointed by this guideline from Microsoft
http://msdn.microsoft.com/en-us/library/ya91ataz(v=vs.100).aspx

However, my application still throw exception when the query returned no rows. What should I do?

I have rebuild the whole solution just in case that the code still referencing the old compiled dataset, but still, no luck.

Edited: Here is the code. The exception is thrown when the returned value is null

try
{
    String modelCode = frameAdapter.GetModelCode(txtStdFrameId.Text.Trim()).ToString();
    if(String.IsNullOrEmpty(modelCode)) //Go directly to exception when data is null here
    {
       //Process the data 
    }
}
catch(Exception ex)
{
     //Log error to a text file
}
  • 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-11T00:40:10+00:00Added an answer on June 11, 2026 at 12:40 am

    Setting a column to NULL this way does not have anything to do with your empty data rows. It will only work if you have at least one row and columns in that row are NULL

    For data returning no rows, you will have to handle this case yourself

    //DataTable
    DataTable dt = ds.Fill(..);
    
    //handle no rows 
    if(dt.Rows.Count == 0)
    {
       //what do you want to do here
    }
    else
    {
       //this dt contains at least one row, now I can use it without any errors/exception
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have query that gives back results like this: Client1 Product1 $500 Client1 Product2
I have query that I run on Oracle that is supposed to allow hyphen
I have query in SQL SERVER 2008 like this. And this is working. SELECT
I have query that looks like this declare @tmpTable Table(id int) insert into @tmpTable(id)
I have a query that runs super fast when executed in the sql editor
I have query that gets 10 random posts , and as you know this
I have query to show the table like this: but I want to PIVOT
I have query with two MtM relations: $em = $this->getEntityManager(); $qb = $em->createQueryBuilder(); $qb
I have query table copyQuery which has Soil Condition has one of the columns,
I have query like this : SELECT EXTRACT(MONTH FROM d.mydate) AS synmonth, SUM(apcp) AS

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.