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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:47:41+00:00 2026-05-23T11:47:41+00:00

I make a query in coding. But I got conversion error. Please check my

  • 0

I make a query in coding. But I got conversion error. Please check my fault.

My query is below

        Dim strSelect As String = ""

        strSelect = "SELECT " & _                                            
                    "Description As [Desc], " & _
                    "iif(CurCons = 0, " - ", CurCons) As [CCQty] " & _
                    "FROM tblCur"

Exception error is like

Conversion from string “iif(CurCons =
0, ” to type ‘Double’ is not valid

Acturally, in my report, i wanna show if it’s zero then ‘-‘. If i set it in this string. I got another error like below

The provider could not determine the
Decimal value. For example, the row
was just created, the default for the
Decimal column was not available, and
the consumer had not yet set a new
Decimal value.

From da.Fill

Dim cmd As New OleDbCommand(strDynamic, m_DBConn)
        Dim da As New OleDbDataAdapter(cmd)
        da.Fill(ds, "tblCur")

How to solve this?

  • 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-23T11:47:42+00:00Added an answer on May 23, 2026 at 11:47 am
    strSelect = "SELECT " & _                                            
                "Description As [Desc], " & _
                "IIF(CurCons = 0 OR ISNULL(CurCons), ' - ', CStr(CurCons)) As [CCQty] " & _
                "FROM tblCur"
    

    You are still in the SQL Query when you are doing the IIF statement, so you do not want to use the “ characters for strings, instead you will use ‘.

    Your report would need the field where the value is outputted to be set to the Text type, otherwise you will see an error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I make a query: String query = SELECT DISTINCT a FROM A a FETCH
I need to make a query like this: SELECT PNPDeviceID FROM Win32_NetworkAdapter WHERE AdapterTypeId
How could I make this kind of query e.g. in MySQL SELECT * FROM
I have a mysql SELECT query which is fast (<0.1 sec) but only the
I want make query select all names from table 'a' where from table 'b'
When I make a query, I often wonder about this: Is it better to
I want to make a query to list cats that took longer than average
I need to make a query to one of Google's services. I read this
How can I programmatically make a query in MS Access default to landscape when
I would like to make a query which needs to compare an property's property

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.