Skip to main content
added 10 characters in body; edited tags; edited title
Source Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663

VB.Net gives Errorerror with CASE SELECT

The following VB.Net code runs fine on SQL Server but gives an error on Access:

sql = "SELECT sr.itemcode, sr.itemname,  SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
                    "SUM(sr.itemunits) AS [Total Units Sold] " & _
                  "FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"
sql = "SELECT sr.itemcode, sr.itemname, SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
      "SUM(sr.itemunits) AS [Total Units Sold] " & _
      "FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"

The error is:

IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data

IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data

VB.Net gives Error with CASE SELECT

The following VB.Net code runs fine on SQL Server but gives an error on Access:

sql = "SELECT sr.itemcode, sr.itemname,  SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
                    "SUM(sr.itemunits) AS [Total Units Sold] " & _
                  "FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"

The error is:

IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data

VB.Net error with CASE SELECT

The following VB.Net code runs fine on SQL Server but gives an error on Access:

sql = "SELECT sr.itemcode, sr.itemname, SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
      "SUM(sr.itemunits) AS [Total Units Sold] " & _
      "FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"

The error is:

IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data
deleted 31 characters in body; edited tags
Source Link
Daniel Hutmacher
  • 9.1k
  • 1
  • 26
  • 52

theThe following VB.Net code runs fine inon SQL Server but givegives an error in VB.Net - My DB is MSon Access:

sql = "SELECT sr.itemcode, sr.itemname,  SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
                    "SUM(sr.itemunits) AS [Total Units Sold] " & _
                  "FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"

The error is: IErrorInfo

IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data

Please how do I resolve this

Thanks

the code runs fine in SQL but give error in VB.Net - My DB is MS Access

sql = "SELECT sr.itemcode, sr.itemname,  SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
                    "SUM(sr.itemunits) AS [Total Units Sold] " & _
                  "FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"

The error is: IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data

Please how do I resolve this

Thanks

The following VB.Net code runs fine on SQL Server but gives an error on Access:

sql = "SELECT sr.itemcode, sr.itemname,  SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
                    "SUM(sr.itemunits) AS [Total Units Sold] " & _
                  "FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"

The error is:

IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data

Source Link

VB.Net gives Error with CASE SELECT

the code runs fine in SQL but give error in VB.Net - My DB is MS Access

sql = "SELECT sr.itemcode, sr.itemname,  SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
                    "SUM(sr.itemunits) AS [Total Units Sold] " & _
                  "FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"

The error is: IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data

Please how do I resolve this

Thanks