473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Invalid object name problem

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("connectionStrin gNW")

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
1 2331
in this case i'm pretty sure your SQL must be wrong.
probably the table Products isn't there anymore or renamed or something
else.
cheers jazper


"Frank Py" <fp*@proactnet.com> wrote in message
news:eY****************@TK2MSFTNGP09.phx.gbl...
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("connectionStrin gNW")

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Glenn A. Harlan | last post by:
Why am I receiving the below error when calling - Path.GetTempFileName() The directory name is invalid. Description: An unhandled exception occurred during the execution of the current web...
3
by: Paul | last post by:
I have an Access 2000 database with a form that is giving me some major headaches. When you open the form, it displays all records and allows editing, but has AllowAdditions set to False so that...
7
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
5
by: lds | last post by:
I am getting the following error: The "SendUsing" configuration value is invalid. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
9
by: MR | last post by:
I get the following Exception "The data at the root level is invalid. Line 1, position 642" whenever I try to deserialize an incoming SOAP message. The incoming message is formed well and its...
3
by: Anders Jansson | last post by:
Hi all. I have 2 problems when I try to open and convert an ASP.NET VS 2003 web-applikation in VS 2005. In VS 2003 I have no problems at all! First: One subfolder with will not be converted!...
1
by: samarthkumar84 | last post by:
Hi I had used following code for sending e-mail but facing this problem. I want to send this e-mail in ASP.NET using VB.NET code. I am attaching both code an output. CODE Imports...
4
by: =?Utf-8?B?THluZXJz?= | last post by:
Hello All, We have a VB.NET application writen using VS 2003. This application apens an excel file from a vendor, reads the data and performs whatever functions it needs. We recently upgraded our...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.