CS0234 - Are you missing a reference?? Works on localhost, not on server.

Discussion in 'ASP .Net' started by Mark, Oct 29, 2004.

  1. Mark

    Mark Guest

    Hi,

    I'm fairly new to .NET and having problems getting an ASP.NET page
    working on my web host.

    The page works fine on my PC running against localhost. I have a MySQL
    database and a simple C# app with an odbcConnection object,
    odbcDataAdapter and a datasetCustomers object placed on the form.

    On page load, I fill the datasetCustomers from the "Customers" table
    retrieved via the odbcDataAdapter and then bind this to a DataGrid on
    the form - this works perfectly on localhost and the web-page displays
    the contents of the Customers table.

    I've got the same database on the webhost and I'm fairly sure it
    should all work, but I get the following error: -

    Compiler Error Message: CS0234: The type or namespace name
    'dsCustomers' does not exist in the class or namespace
    'BoundMySQLTest' (are you missing an assembly reference?)

    Source Error:
    Line 24: protected System.Data.Odbc.OdbcCommand odbcInsertCommand1;
    Line 25: protected System.Web.UI.WebControls.DataGrid DataGrid1;
    Line 26: protected BoundMySQLTest.dsCustomers dsCustomers1;
    Line 27:
    Line 28: private void Page_Load(object sender, System.EventArgs e)

    It states the error is with line 26.

    The only change I've made before uploading it is to change the top
    line in Webform1.aspx from: -

    <%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
    AutoEventWireup="false" Inherits="BoundMySQLTest.WebForm1"%>

    to: -

    <%@ Page language="c#" Src="WebForm1.aspx.cs" AutoEventWireup="false"
    Inherits="BoundMySQLTest.WebForm1"%>

    For some reason, none of my projects work on my webhost with the
    "Codebehind" line - I always have to change it to Src.

    Other than this, the project is identical - works on localhost, but
    not on my webserver.

    I've had a good read around on here - read a few articles about
    manually adding references in the Global.asax, but I have to admit I'm
    still fairly confused.

    Any help would be greatly appreciated,

    Mark.
    Mark, Oct 29, 2004
    #1
    1. Advertising

  2. Mark

    Hans Kesting Guest

    Mark wrote:
    > Hi,
    >
    > I'm fairly new to .NET and having problems getting an ASP.NET page
    > working on my web host.
    >
    > The page works fine on my PC running against localhost. I have a MySQL
    > database and a simple C# app with an odbcConnection object,
    > odbcDataAdapter and a datasetCustomers object placed on the form.
    >
    > On page load, I fill the datasetCustomers from the "Customers" table
    > retrieved via the odbcDataAdapter and then bind this to a DataGrid on
    > the form - this works perfectly on localhost and the web-page displays
    > the contents of the Customers table.
    >
    > I've got the same database on the webhost and I'm fairly sure it
    > should all work, but I get the following error: -
    >
    > Compiler Error Message: CS0234: The type or namespace name
    > 'dsCustomers' does not exist in the class or namespace
    > 'BoundMySQLTest' (are you missing an assembly reference?)
    >
    > Source Error:
    > Line 24: protected System.Data.Odbc.OdbcCommand odbcInsertCommand1;
    > Line 25: protected System.Web.UI.WebControls.DataGrid DataGrid1;
    > Line 26: protected BoundMySQLTest.dsCustomers dsCustomers1;
    > Line 27:
    > Line 28: private void Page_Load(object sender, System.EventArgs e)
    >
    > It states the error is with line 26.


    What is "dsCustomers" exactly?
    The declaration seems to specify that it's a class in the BoundMySQLTest namespace,
    but a name like this I personally would use to specify a variable pointing to
    a DataSet that contained "customer" details.

    >
    > The only change I've made before uploading it is to change the top
    > line in Webform1.aspx from: -
    >
    > <%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
    > AutoEventWireup="false" Inherits="BoundMySQLTest.WebForm1"%>
    >
    > to: -
    >
    > <%@ Page language="c#" Src="WebForm1.aspx.cs" AutoEventWireup="false"
    > Inherits="BoundMySQLTest.WebForm1"%>
    >
    > For some reason, none of my projects work on my webhost with the
    > "Codebehind" line - I always have to change it to Src.
    >


    The "codebehind" is used by VS.Net and you run it (locally) by compiling
    the codebehind into a dll that is then used.
    When you upload all sourcefiles (aspx.cs) and no dll's (see bin directory)
    then it needs to be changed to "src" so that the system can again find the
    codebehind files and compile them.

    Within VS.Net there is a "Copy Project" function to send all files needed
    to a webserver. This will include the compiled dll's and exclude the .cs
    (as they are not needed). Make sure that all support files (like xml files)
    that you want to have at that webserver have a "build action" of "content"
    instead of "none" (see file properties).


    > Other than this, the project is identical - works on localhost, but
    > not on my webserver.
    >
    > I've had a good read around on here - read a few articles about
    > manually adding references in the Global.asax, but I have to admit I'm
    > still fairly confused.
    >
    > Any help would be greatly appreciated,
    >
    > Mark.
    Hans Kesting, Oct 29, 2004
    #2
    1. Advertising

  3. Mark

    Mark Guest

    Thanks for the reply Hans,

    dsCustomers is the automatically generated data set (apologies - I've
    called it datasetCustomers in my explanation) - that I created from
    the Data Adapter object.

    I've tried to use the "Copy Project" option but can't get it to work -
    I don't think my web host supports it, so I have to FTP everything
    over.

    Mark
    Mark, Oct 30, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Meade

    Re: localhost works but not server name

    Rob Meade, Aug 9, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    428
    Rob Meade
    Aug 9, 2004
  2. Bill Johnson
    Replies:
    0
    Views:
    1,232
    Bill Johnson
    Jul 8, 2005
  3. Replies:
    0
    Views:
    5,129
  4. Bill Johnson

    CS0234 Global does not exist ... but it genuinely does

    Bill Johnson, Jul 8, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    197
    Bill Johnson
    Jul 8, 2005
  5. koicat
    Replies:
    0
    Views:
    223
    koicat
    Jul 2, 2010
Loading...

Share This Page