The type or namespace name 'UpdateProduct' could not be found (are you missing a

  • Thread starter CdnRebel via DotNetMonster.com
  • Start date
C

CdnRebel via DotNetMonster.com

The type or namespace name 'UpdateProduct' could not be found (are you
missing a using directive or an assembly reference?)

Hi,

I am new to ASP.NET, C# and Visual Studio 2005. I am just learning to
compile and Visual Studio 2005 converted the programs to a newer version
which is why I am getting compile errors. The code with the problem is below:


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace Furniture
{
/// <summary>
/// Summary description for UpdateProduct.
/// </summary>
public partial class Migrated_UpdateProduct : UpdateProduct
{
protected System.Web.UI.WebControls.Label lblMessage;
protected System.Web.UI.WebControls.TextBox txtProductName;
protected System.Web.UI.WebControls.TextBox txtProductDescription;
protected System.Web.UI.WebControls.CheckBox
chkDisplayedOnThumbnailPage;
protected System.Web.UI.WebControls.TextBox txtOrderNumber;
protected System.Web.UI.WebControls.CheckBox chkActive;
protected System.Web.UI.HtmlControls.HtmlInputFile fileUpload;
protected System.Web.UI.WebControls.DropDownList dplProduct;
protected System.Web.UI.WebControls.HyperLink lnkTopRight;
protected System.Web.UI.HtmlControls.HtmlInputFile fileThumbnail;
protected System.Web.UI.WebControls.RequiredFieldValidator
Requiredfieldvalidator3;

protected void Page_Load(object sender, System.EventArgs e)
{
if(Session["SessionUserID"] != null)
{
lnkTopRight.Text="ADMINISTRATION";
lnkTopRight.NavigateUrl="ProductManagement.aspx";
}
else
{

lnkTopRight.Text="LOG IN";
lnkTopRight.NavigateUrl="login.aspx";
}


if(Request["ProductID"] !=null)
{
intProductID=int.Parse(Request["ProductID"].ToString());
}
if(!IsPostBack)
{

GetProductInfo(intProductID);
LoadProductList(intProductID);
}
}

The above are lines 10 to 66 and the error is on line 27 which is this line:
public partial class Migrated_UpdateProduct : UpdateProduct

Can someone please help? The website owner is under the false impression
that he will need someone to start from scratch with the changes. I believe
that the changes can be completed as soon as I get a clean compile. I could
really use some one on one help, but I have none.

Thanks!!!
 
N

Nicholas Paldino [.NET/C# MVP]

Well, where is UpdateProduct defined? The type has to be in a
referenced assembly (or in the same assembly) and the name of the type has
to be able to be resolved, either through a full type name (with namespace)
or with a using statement.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

CdnRebel via DotNetMonster.com said:
The type or namespace name 'UpdateProduct' could not be found (are you
missing a using directive or an assembly reference?)

Hi,

I am new to ASP.NET, C# and Visual Studio 2005. I am just learning to
compile and Visual Studio 2005 converted the programs to a newer version
which is why I am getting compile errors. The code with the problem is
below:


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace Furniture
{
/// <summary>
/// Summary description for UpdateProduct.
/// </summary>
public partial class Migrated_UpdateProduct : UpdateProduct
{
protected System.Web.UI.WebControls.Label lblMessage;
protected System.Web.UI.WebControls.TextBox txtProductName;
protected System.Web.UI.WebControls.TextBox txtProductDescription;
protected System.Web.UI.WebControls.CheckBox
chkDisplayedOnThumbnailPage;
protected System.Web.UI.WebControls.TextBox txtOrderNumber;
protected System.Web.UI.WebControls.CheckBox chkActive;
protected System.Web.UI.HtmlControls.HtmlInputFile fileUpload;
protected System.Web.UI.WebControls.DropDownList dplProduct;
protected System.Web.UI.WebControls.HyperLink lnkTopRight;
protected System.Web.UI.HtmlControls.HtmlInputFile fileThumbnail;
protected System.Web.UI.WebControls.RequiredFieldValidator
Requiredfieldvalidator3;

protected void Page_Load(object sender, System.EventArgs e)
{
if(Session["SessionUserID"] != null)
{
lnkTopRight.Text="ADMINISTRATION";
lnkTopRight.NavigateUrl="ProductManagement.aspx";
}
else
{

lnkTopRight.Text="LOG IN";
lnkTopRight.NavigateUrl="login.aspx";
}


if(Request["ProductID"] !=null)
{
intProductID=int.Parse(Request["ProductID"].ToString());
}
if(!IsPostBack)
{

GetProductInfo(intProductID);
LoadProductList(intProductID);
}
}

The above are lines 10 to 66 and the error is on line 27 which is this
line:
public partial class Migrated_UpdateProduct : UpdateProduct

Can someone please help? The website owner is under the false impression
that he will need someone to start from scratch with the changes. I
believe
that the changes can be completed as soon as I get a clean compile. I
could
really use some one on one help, but I have none.

Thanks!!!
 
C

CdnRebel via DotNetMonster.com

Thanks, for getting back to me. The code before the conversion was:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace Furniture
{
/// <summary>
/// Summary description for UpdateProduct.
/// </summary>
public class UpdateProduct : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblMessage;
protected System.Web.UI.WebControls.TextBox txtProductName;
protected System.Web.UI.WebControls.TextBox txtProductDescription;
protected System.Web.UI.WebControls.CheckBox chkDisplayedOnThumbnailPage;
protected System.Web.UI.WebControls.TextBox txtOrderNumber;
protected System.Web.UI.WebControls.Button btnSave;
protected System.Web.UI.WebControls.CheckBox chkActive;
protected System.Web.UI.HtmlControls.HtmlInputFile fileUpload;

public int intProductID=0;
protected System.Web.UI.WebControls.DropDownList dplProduct;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator
Requiredfieldvalidator2;
protected System.Web.UI.WebControls.HyperLink lnkTopRight;
protected System.Web.UI.HtmlControls.HtmlInputFile fileThumbnail;
protected System.Web.UI.WebControls.RequiredFieldValidator
Requiredfieldvalidator3;

private void Page_Load(object sender, System.EventArgs e)
{
if(Session["SessionUserID"] != null)
{
lnkTopRight.Text="ADMINISTRATION";
lnkTopRight.NavigateUrl="ProductManagement.aspx";
}
else
{

lnkTopRight.Text="LOG IN";
lnkTopRight.NavigateUrl="login.aspx";
}


if(Request["ProductID"] !=null)
{
intProductID=int.Parse(Request["ProductID"].ToString());
}
if(!IsPostBack)
{

GetProductInfo(intProductID);
LoadProductList(intProductID);
}
}


Is there something in the current version that I need to change?

I also found the following code in the App_Code\components folder in a file
called ProductDB.cs:

public bool UpdateProduct(int intProductID, string strProductName, decimal
dclPrice,bool blnForSetOnly,
string strProductDescription,int intOrderNumofDisplay,
bool blnDisplayedOnThumbnailPage, bool blnActive, int
intAssociatedProductID)
{
bool blnUpdateProduct=false;
SqlConnection oConnnection=GetConnection();
SqlCommand cmd=new SqlCommand("spUpdateProduct",oConnnection);
cmd.CommandType=CommandType.StoredProcedure;

SqlParameter paProductID=new SqlParameter("@productID",SqlDbType.Int);
paProductID.Value=intProductID;
cmd.Parameters.Add(paProductID);

SqlParameter paProductName=new SqlParameter("@productName",SqlDbType.
VarChar,100);
paProductName.Value=strProductName;
cmd.Parameters.Add(paProductName);

SqlParameter paPrice=new SqlParameter("@dclPrice",SqlDbType.Decimal);
paPrice.Value=dclPrice;
cmd.Parameters.Add(paPrice);

SqlParameter paForSetOnly=new SqlParameter("@blnForSetOnly",SqlDbType.Int)
;
paForSetOnly.Value=blnForSetOnly;
cmd.Parameters.Add(paForSetOnly);

SqlParameter paProductDescription=new SqlParameter("@productDescription",
SqlDbType.VarChar,7500);
paProductDescription.Value=strProductDescription;
cmd.Parameters.Add(paProductDescription);

SqlParameter paOrderNumofDisplay=new SqlParameter("@orderNumofDisplay",
SqlDbType.Int);
paOrderNumofDisplay.Value=intOrderNumofDisplay;
cmd.Parameters.Add(paOrderNumofDisplay);

SqlParameter paDisplayedOnThumbnaiPage=new SqlParameter
("@displayedOnThumbnaiPage",SqlDbType.Bit);
paDisplayedOnThumbnaiPage.Value=blnDisplayedOnThumbnailPage;
cmd.Parameters.Add(paDisplayedOnThumbnaiPage);

SqlParameter paAssociatedProductID=new SqlParameter("@associatedProductID",
SqlDbType.Int);
paAssociatedProductID.Value=intAssociatedProductID;
cmd.Parameters.Add(paAssociatedProductID);

SqlParameter paActive=new SqlParameter("@active",SqlDbType.Bit);
paActive.Value=blnActive;
cmd.Parameters.Add(paActive);

try
{
oConnnection.Open();
cmd.ExecuteNonQuery();
blnUpdateProduct=true;
}
catch(System.Data.SqlClient.SqlException ex)
{
throw ex;
}
finally
{
oConnnection.Close();
}
return blnUpdateProduct;
}

Do I need to change something in there as well? I am guessing that if I
change something in the App_Code components folder that I will need to be
making many more changes throughout the website.

I don't know where to start with this.

Thanks,

Mary

Well, where is UpdateProduct defined? The type has to be in a
referenced assembly (or in the same assembly) and the name of the type has
to be able to be resolved, either through a full type name (with namespace)
or with a using statement.
The type or namespace name 'UpdateProduct' could not be found (are you
missing a using directive or an assembly reference?)
[quoted text clipped - 77 lines]
Thanks!!!
 
N

Nicholas Paldino [.NET/C# MVP]

Well, it seems like the name of the class before was UpdateProduct, then
you changed the class name to be Migrated_UpdateProduct and then derived
from UpdateProduct. Did you do this in the same file? If so, you
effectively removed the definition of the base class you are trying to
derive from.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

CdnRebel via DotNetMonster.com said:
Thanks, for getting back to me. The code before the conversion was:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace Furniture
{
/// <summary>
/// Summary description for UpdateProduct.
/// </summary>
public class UpdateProduct : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblMessage;
protected System.Web.UI.WebControls.TextBox txtProductName;
protected System.Web.UI.WebControls.TextBox txtProductDescription;
protected System.Web.UI.WebControls.CheckBox chkDisplayedOnThumbnailPage;
protected System.Web.UI.WebControls.TextBox txtOrderNumber;
protected System.Web.UI.WebControls.Button btnSave;
protected System.Web.UI.WebControls.CheckBox chkActive;
protected System.Web.UI.HtmlControls.HtmlInputFile fileUpload;

public int intProductID=0;
protected System.Web.UI.WebControls.DropDownList dplProduct;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator
Requiredfieldvalidator2;
protected System.Web.UI.WebControls.HyperLink lnkTopRight;
protected System.Web.UI.HtmlControls.HtmlInputFile fileThumbnail;
protected System.Web.UI.WebControls.RequiredFieldValidator
Requiredfieldvalidator3;

private void Page_Load(object sender, System.EventArgs e)
{
if(Session["SessionUserID"] != null)
{
lnkTopRight.Text="ADMINISTRATION";
lnkTopRight.NavigateUrl="ProductManagement.aspx";
}
else
{

lnkTopRight.Text="LOG IN";
lnkTopRight.NavigateUrl="login.aspx";
}


if(Request["ProductID"] !=null)
{
intProductID=int.Parse(Request["ProductID"].ToString());
}
if(!IsPostBack)
{

GetProductInfo(intProductID);
LoadProductList(intProductID);
}
}


Is there something in the current version that I need to change?

I also found the following code in the App_Code\components folder in a
file
called ProductDB.cs:

public bool UpdateProduct(int intProductID, string strProductName, decimal
dclPrice,bool blnForSetOnly,
string strProductDescription,int intOrderNumofDisplay,
bool blnDisplayedOnThumbnailPage, bool blnActive, int
intAssociatedProductID)
{
bool blnUpdateProduct=false;
SqlConnection oConnnection=GetConnection();
SqlCommand cmd=new SqlCommand("spUpdateProduct",oConnnection);
cmd.CommandType=CommandType.StoredProcedure;

SqlParameter paProductID=new SqlParameter("@productID",SqlDbType.Int);
paProductID.Value=intProductID;
cmd.Parameters.Add(paProductID);

SqlParameter paProductName=new SqlParameter("@productName",SqlDbType.
VarChar,100);
paProductName.Value=strProductName;
cmd.Parameters.Add(paProductName);

SqlParameter paPrice=new SqlParameter("@dclPrice",SqlDbType.Decimal);
paPrice.Value=dclPrice;
cmd.Parameters.Add(paPrice);

SqlParameter paForSetOnly=new SqlParameter("@blnForSetOnly",SqlDbType.Int)
;
paForSetOnly.Value=blnForSetOnly;
cmd.Parameters.Add(paForSetOnly);

SqlParameter paProductDescription=new SqlParameter("@productDescription",
SqlDbType.VarChar,7500);
paProductDescription.Value=strProductDescription;
cmd.Parameters.Add(paProductDescription);

SqlParameter paOrderNumofDisplay=new SqlParameter("@orderNumofDisplay",
SqlDbType.Int);
paOrderNumofDisplay.Value=intOrderNumofDisplay;
cmd.Parameters.Add(paOrderNumofDisplay);

SqlParameter paDisplayedOnThumbnaiPage=new SqlParameter
("@displayedOnThumbnaiPage",SqlDbType.Bit);
paDisplayedOnThumbnaiPage.Value=blnDisplayedOnThumbnailPage;
cmd.Parameters.Add(paDisplayedOnThumbnaiPage);

SqlParameter paAssociatedProductID=new
SqlParameter("@associatedProductID",
SqlDbType.Int);
paAssociatedProductID.Value=intAssociatedProductID;
cmd.Parameters.Add(paAssociatedProductID);

SqlParameter paActive=new SqlParameter("@active",SqlDbType.Bit);
paActive.Value=blnActive;
cmd.Parameters.Add(paActive);

try
{
oConnnection.Open();
cmd.ExecuteNonQuery();
blnUpdateProduct=true;
}
catch(System.Data.SqlClient.SqlException ex)
{
throw ex;
}
finally
{
oConnnection.Close();
}
return blnUpdateProduct;
}

Do I need to change something in there as well? I am guessing that if I
change something in the App_Code components folder that I will need to be
making many more changes throughout the website.

I don't know where to start with this.

Thanks,

Mary

Well, where is UpdateProduct defined? The type has to be in a
referenced assembly (or in the same assembly) and the name of the type has
to be able to be resolved, either through a full type name (with
namespace)
or with a using statement.
The type or namespace name 'UpdateProduct' could not be found (are you
missing a using directive or an assembly reference?)
[quoted text clipped - 77 lines]
Thanks!!!
 
C

CdnRebel via DotNetMonster.com

Nicholas said:
Well, it seems like the name of the class before was UpdateProduct, then
you changed the class name to be Migrated_UpdateProduct and then derived
from UpdateProduct. Did you do this in the same file? If so, you
effectively removed the definition of the base class you are trying to
derive from.
Thanks, for getting back to me. The code before the conversion was:
[quoted text clipped - 161 lines]

I didn't do any of it. The previous version of the code was already written
in an older version and Visual Studio 2005 changed it when it did the
conversion and I don't know what I need to do to correct it to work with the
newer version.

Thanks,
Mary
 
G

Guest

I see this post and an answer two times in the same group. Could be a glitch?
Anyway, in case you missed the other, this page explains:
http://msdn2.microsoft.com/en-us/library/aa479312.aspx

Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com



CdnRebel via DotNetMonster.com said:
The type or namespace name 'UpdateProduct' could not be found (are you
missing a using directive or an assembly reference?)

Hi,

I am new to ASP.NET, C# and Visual Studio 2005. I am just learning to
compile and Visual Studio 2005 converted the programs to a newer version
which is why I am getting compile errors. The code with the problem is below:


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace Furniture
{
/// <summary>
/// Summary description for UpdateProduct.
/// </summary>
public partial class Migrated_UpdateProduct : UpdateProduct
{
protected System.Web.UI.WebControls.Label lblMessage;
protected System.Web.UI.WebControls.TextBox txtProductName;
protected System.Web.UI.WebControls.TextBox txtProductDescription;
protected System.Web.UI.WebControls.CheckBox
chkDisplayedOnThumbnailPage;
protected System.Web.UI.WebControls.TextBox txtOrderNumber;
protected System.Web.UI.WebControls.CheckBox chkActive;
protected System.Web.UI.HtmlControls.HtmlInputFile fileUpload;
protected System.Web.UI.WebControls.DropDownList dplProduct;
protected System.Web.UI.WebControls.HyperLink lnkTopRight;
protected System.Web.UI.HtmlControls.HtmlInputFile fileThumbnail;
protected System.Web.UI.WebControls.RequiredFieldValidator
Requiredfieldvalidator3;

protected void Page_Load(object sender, System.EventArgs e)
{
if(Session["SessionUserID"] != null)
{
lnkTopRight.Text="ADMINISTRATION";
lnkTopRight.NavigateUrl="ProductManagement.aspx";
}
else
{

lnkTopRight.Text="LOG IN";
lnkTopRight.NavigateUrl="login.aspx";
}


if(Request["ProductID"] !=null)
{
intProductID=int.Parse(Request["ProductID"].ToString());
}
if(!IsPostBack)
{

GetProductInfo(intProductID);
LoadProductList(intProductID);
}
}

The above are lines 10 to 66 and the error is on line 27 which is this line:
public partial class Migrated_UpdateProduct : UpdateProduct

Can someone please help? The website owner is under the false impression
that he will need someone to start from scratch with the changes. I believe
that the changes can be completed as soon as I get a clean compile. I could
really use some one on one help, but I have none.

Thanks!!!
 
C

CdnRebel via DotNetMonster.com

Hi Peter,

The first response indicated that there was commenting put in by Visual
Studio 2005 and although, it seemed to clear up the problem that time; it
came back again, but this time there was no commenting to be removed so I
need another answer. I will check out the page you advised and see if I can
find an answer.

Thanks,

Mary
I see this post and an answer two times in the same group. Could be a glitch?
Anyway, in case you missed the other, this page explains:
http://msdn2.microsoft.com/en-us/library/aa479312.aspx

Peter
The type or namespace name 'UpdateProduct' could not be found (are you
missing a using directive or an assembly reference?)
[quoted text clipped - 74 lines]
Thanks!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top