Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > CS0234 - Are you missing a reference?? Works on localhost, not on server.

Reply
Thread Tools

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

 
 
Mark
Guest
Posts: n/a
 
      10-29-2004
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.
 
Reply With Quote
 
 
 
 
Hans Kesting
Guest
Posts: n/a
 
      10-29-2004
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.



 
Reply With Quote
 
 
 
 
Mark
Guest
Posts: n/a
 
      10-30-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR CS0234: The type or namespace name 'DataAccessHelper' does not exist in the namespace 'BCC' (are you missing an assembly reference?) li.eddie@gmail.com ASP .Net 0 01-06-2006 11:31 AM
CS0234 Global does not exist ... but it genuinely does Bill Johnson ASP .Net Datagrid Control 0 07-08-2005 06:34 PM
CS0234 Global does not exist ... but it genuinely does Bill Johnson ASP .Net 0 07-08-2005 06:34 PM
JIT Cmpile Error CS0234 =?Utf-8?B?U3VyamVldCBHaWxs?= ASP .Net 1 08-06-2004 04:46 PM
CS0234 when using a VB assembly in my C# web app George W. ASP .Net 3 06-04-2004 03:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57