Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 12th, 2010, 09:10 AM
Authorized User
 
Join Date: Apr 2008
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
Default Inaccessible due to it's protection level

I have picked up a project from someone else and cannot get it to compile.

The solution is a web application containing two class libraries. When compiling, I am getting an error which reads 'fulfilmentDAL.FulfilmentSchemaDataSetTableAdapter s.FULFILMENT_VERSIONSTableAdapter.Connection' is inaccessible due to its protection level and have tried to search on Google for an answer - found nothing of any real use.

The error points to the following code, with the error on the "Connection" for the second line.

FULFILMENT_VERSIONSTableAdapter VersionsAdapter = new FULFILMENT_VERSIONSTableAdapter();
VersionsAdapter.Connection = new System.Data.OracleClient.OracleConnection(connectionString);

By right-clicking on the FULFILMENT_VERSIONSTableAdapter and going to the definition, we get

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DataObjectAttribute(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapt erDesigner, Microsoft.VSDesigner" +
", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class FULFILMENT_VERSIONSTableAdapter : global::System.ComponentModel.Component {

private global::System.Data.OracleClient.OracleDataAdapter _adapter;

private global::System.Data.OracleClient.OracleConnection _connection;

private global::System.Data.OracleClient.OracleCommand[] _commandCollection;

private bool _clearBeforeFill;

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public FULFILMENT_VERSIONSTableAdapter() {
this.ClearBeforeFill = true;
}
...snip...

I can't see anything that appears to be particularly wrong with the code that I am seeing and hope that someone is able to offer some guidance on this.

Thanks in advance for any help.
__________________
Regards,

Sean
 
Old July 12th, 2010, 10:04 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Looks like the Connection property is not public, can you show the code for that?
(Worst naming convention ever...)
__________________
Joe
http://joe.fawcett.name/
 
Old July 12th, 2010, 10:13 AM
Authorized User
 
Join Date: Apr 2008
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Spot on, thanks!

Changed all of the instances of the connectiont to be "public" and it's resolved the issue (thank you to MS for a clear error message). Naming conventions ... hmmm ... the wonders of inheriting someone else's project, I guess.
__________________
Regards,

Sean





Similar Threads
Thread Thread Starter Forum Replies Last Post
Over Due one month only function jofoxy2000 Access 2 December 13th, 2009 02:57 PM
DuplicateCheck' is inaccessible due to it's protection level [email protected] BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 2 November 24th, 2009 12:17 PM
Protection evad Excel VBA 0 April 26th, 2005 09:06 AM
Protection level noman77 .NET Framework 2.0 0 October 23rd, 2004 07:33 AM
classes :: base class is inaccessible .... Kaliste C# 3 July 16th, 2004 04:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.