[Mono-list] asp.net and Npgsql namespace not found

Carl Olsen carl at carl-olsen.com
Sun Oct 9 17:30:53 EDT 2005


Hi Alan,

I've never tried to compile it on the fly.  I always pre-compile everything.
Use "protected" instead of "private" when you do a button click in a code
behind page, unless you use an event handler.  I'm not an expert, but it
appears that I can use a private method when I have an event handler, and it
appears that I need to use protected methods when I simple call the function
from the aspx page.  I'm reading books on OOP, but I'm still just a
beginner.  It sounds like you could benefit from a book on OOP.  I'm reading
OOP for C# and OOP for PHP, and it helps to see it used with a couple
different programming languages, so you really see how it sits under the
language as the foundation.  Apress and Wrox have excellent books on these
topics, although I think that the Apress books have the edge.

Carl

-----Original Message-----
From: Alan Campbell [mailto:alan.g.campbell at gmail.com] 
Sent: Sunday, October 09, 2005 12:36 PM
To: carl at carl-olsen.com
Cc: mono-list at lists.ximian.com
Subject: Re: [Mono-list] asp.net and Npgsql namespace not found

Carl,

do you compile your codebehind pages into dlls?  If I compile my
codebehind into a dll the error disappears.  Do you think that if the
codebehind page is compiled on the fly it doesn't find the Npgsql
library?

Using the compiled codebehind dll I not get errors like
test.Button1_Click(object, System.EventArgs)' is inaccessible due to
its protection level

Looks like I will have to search for a solution to this problem.

thanks,
Alan.

On 10/9/05, Alan Campbell <alan.g.campbell at gmail.com> wrote:
> Carl,
>
> thanks again.  I already have Npgsql referenced in my codebehind page
> and I can compile console applications that reference Npgsql fine.  It
> looks like it might be something else.
>
> I will probably remove the debian backports of Mono and install via
> the Mono installer.
>
> Alan.
>
> On 10/9/05, Carl Olsen <carl at carl-olsen.com> wrote:
> > I'm not familiar with inline code or vb.net.  I put all of my code into
code
> > behind pages (c#.net).  With Npgsql, I put all of my data code (c#.net)
into
> > class files and make objects to represent the data.  When I actually use
the
> > data in my web pages, I'm just instantiating data objects, so I don't
use
> > the reference to Npgsql at all in those pages.  If you already have
Npgsql
> > in the GAC and you are using Npgsql referenced in your code page, then
you
> > may have another issue unrelated to Npgsql that is causing the problem.
> >
> > Carl
> >
> > -----Original Message-----
> > From: mono-list-bounces at lists.ximian.com
> > [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Alan Campbell
> > Sent: Sunday, October 09, 2005 9:59 AM
> > To: carl at carl-olsen.com; mono-list at lists.ximian.com
> > Subject: Re: [Mono-list] asp.net and Npgsql namespace not found
> >
> > Carl,
> >
> > thanks for the information.  I installed in the GAC.  I already had
> > "using Npgsql;" in my code.  It still has not helped.
> >
> > On a similar note, for a vb.net aspx page I had to have the following
lines:
> > <%@ import Namespace="Npgsql" %>
> > <%@ Assembly Name="Npgsql" %>
> >
> > Do I need an equivalent "Assembly Name" line in my csharp file?
> >
> > Alan.
> >
> > On 10/9/05, Carl Olsen <carl at carl-olsen.com> wrote:
> > > That should be:
> > >
> > >      gacutil -i Npgsql.dll
> > >
> > > Microsoft word automatically capitalized the "i" for me, which is
probably
> > > going to create a compile error.
> > >
> > > Carl
> > >
> > > -----Original Message-----
> > > From: mono-list-bounces at lists.ximian.com
> > > [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Carl Olsen
> > > Sent: Sunday, October 09, 2005 8:46 AM
> > > To: 'Alan Campbell'; mono-list at lists.ximian.com
> > > Subject: RE: [Mono-list] asp.net and Npgsql namespace not found
> > >
> > > I installed Npgsql.dll in the Global Assembly Cache (GAC) by running
the
> > GAC
> > > utility, like this:
> > >
> > >      gacutil -I Npgsql.dll
> > >
> > > I also include it in the code page, like this:
> > >
> > >      using Npgsql;
> > >
> > > That should take care of it.  I believe the RMPs will install it in
the
> > GAC
> > > as well, but it won't hurt to install it again.
> > >
> > > Carl Olsen
> > > http://www.carl-olsen.com/
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: mono-list-bounces at lists.ximian.com
> > > [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Alan Campbell
> > > Sent: Sunday, October 09, 2005 7:14 AM
> > > To: mono-list at lists.ximian.com
> > > Subject: [Mono-list] asp.net and Npgsql namespace not found
> > >
> > > Hi all,
> > >
> > > I am trying to convert code from IIS/Access DB to XSP (or mono-mono) /
> > > PostgreSQL in Debian Sarge.  I can compile and run the Npgsql sample
> > > code fine.  But, I get the following error when I try and use Npgsql
> > > in my codebehind page.
> > >
> > > error CS0246: The type or namespace name `Npgsql' could not be found.
> > > Are you missing a using directive or an assembly reference?
> > >
> > > I guess I am missing something simple, but i could not find a similar
> > > message on the list.  Browsing the archives on neotonic.com appear to
> > > be broken.
> > >
> > > Thanks
> > > Alan Campbell.
> > > _______________________________________________
> > > Mono-list maillist  -  Mono-list at lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-list
> > >
> > > _______________________________________________
> > > Mono-list maillist  -  Mono-list at lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-list
> > >
> > >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
> >
>



More information about the Mono-list mailing list