F
Frank Py
I'm getting the following error when trying an example app:
Invalid object name 'Products'.
Exception Details: System.Data.SqlClient.SqlException: Invalid object
name 'Products'.
Line 22: myCommand.Fill(ds)
Help appreciated. Thanks - Frank
<code>
<%@ Page Language="VB" autoeventwireup="false" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Drawing" %>
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs) Handles MyBase.Load
' TODO: Update the ConnectionString and CommandText values
for your application
Dim ConnectionString As String =
ConfigurationSettings.AppSettings("connectionStringNW")
Dim CommandText As String = "Select CASE WHEN
(Grouping(CategoryName)=1) THEN 'MainTotal' ELSE categoryname END AS
CategoryName, "
CommandText += " CASE WHEN (Grouping(ProductName)=1) THEN
'SubTotal' ELSE Productname END AS ProductName,"
CommandText += " Sum(UnitPrice) as unitprice, "
CommandText += " Sum(UnitsinStock) as UnitsinStock "
CommandText += " from Products INNER JOIN Categories On
Products.categoryID = Categories.CategoryID"
CommandText += " Group By Categoryname, ProductName WITh
ROLLUP "
Dim myConnection As New SqlConnection(ConnectionString)
Dim myCommand As New SqlDataAdapter(CommandText,
myConnection)
Dim ds As New DataSet
myCommand.Fill(ds)
</code>
Thanks
Invalid object name 'Products'.
Exception Details: System.Data.SqlClient.SqlException: Invalid object
name 'Products'.
Line 22: myCommand.Fill(ds)
Help appreciated. Thanks - Frank
<code>
<%@ Page Language="VB" autoeventwireup="false" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Drawing" %>
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs) Handles MyBase.Load
' TODO: Update the ConnectionString and CommandText values
for your application
Dim ConnectionString As String =
ConfigurationSettings.AppSettings("connectionStringNW")
Dim CommandText As String = "Select CASE WHEN
(Grouping(CategoryName)=1) THEN 'MainTotal' ELSE categoryname END AS
CategoryName, "
CommandText += " CASE WHEN (Grouping(ProductName)=1) THEN
'SubTotal' ELSE Productname END AS ProductName,"
CommandText += " Sum(UnitPrice) as unitprice, "
CommandText += " Sum(UnitsinStock) as UnitsinStock "
CommandText += " from Products INNER JOIN Categories On
Products.categoryID = Categories.CategoryID"
CommandText += " Group By Categoryname, ProductName WITh
ROLLUP "
Dim myConnection As New SqlConnection(ConnectionString)
Dim myCommand As New SqlDataAdapter(CommandText,
myConnection)
Dim ds As New DataSet
myCommand.Fill(ds)
</code>
Thanks