1 Replies - 541 Views - Last Post: 19 July 2012 - 05:45 AM Rate Topic: -----

#1 tendaimare  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 170
  • Joined: 04-November 10

conversion from dbnull to sting is not valid

Posted 19 July 2012 - 05:28 AM

I am usiing the code below to calculate the sum of rows in my datatable with the productcode in the textbox but if the code is not in the datatable I get the error "conversion from dbnull to sting is not valid". How can i trap this error in this scenario.


      Try

            RadTextBox8.Text = myTable.Compute("SUM(PercentageInMix)", "ProductCode = '" & txtProductCode.Text & "' ")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try




Is This A Good Question/Topic? 0
  • +

Replies To: conversion from dbnull to sting is not valid

#2 tendaimare  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 170
  • Joined: 04-November 10

Re: conversion from dbnull to sting is not valid

Posted 19 July 2012 - 05:45 AM

I even tried this

RadTextBox8.Text = myTable.Compute("SUM(PercentageInMix)", String.IsNullOrEmpty("ProductCode = '" & txtProductCode.Text & "'    "))



Was This Post Helpful? 0
  • +
  • -

Page 1 of 1