Turn your Mobile Apps into m-commerce apps – Learn More!

You're Browsing As A Guest! Register Now...
Become a C# Expert!

Join 414,938 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,680 people online right now.Registration is fast and FREE... Join Now!



Inconsistency Accessibility Rate Topic: -----

#1 izzahaf  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 1
  • View blog
  • Posts: 104
  • Joined: 12-March 09


Dream Kudos: 0

Share |

Inconsistency Accessibility

Posted 03 May 2009 - 06:17 AM

hi all, plz help me
i get error :
Error 1 Inconsistent accessibility: field type 'Skripsi.Data.dbaseConn' is less accessible than field 'Skripsi.GUI.listVariable.dbase' D:\--- m y S c r i p t\Skripsi\Bismillah\GUI\listVariable.cs 15 26 Skripsi


here's my code :

namespace Skripsi.GUI
{
	public partial class listVariable : Form
	{
		public dbaseConn dbase;
		public listVariable()
		{
			InitializeComponent();
			this.dbase = new dbaseConn();
			this.dbase.Open();
		}

	   

		private void listVariable_Load(object sender, EventArgs e)
		{
			
			this.dbase.Connect("SELECT category.nm FROM category");
			try
			{
				while (dbase.variablereader.Read())
				{
					string getvar = dbase.variablereader.GetString(0);
					this.cmbCat.Items.Add(getvar);
				}
			}
			catch
			{
				MessageBox.Show("error on getting variables");
			}

		}
								  

		private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
		{
			string selectCat = this.cmbCat.SelectedItem.ToString();
			this.dbase.Connect("SELECT variable.nm FROM variable WHERE variable.id  IN (SELECT var_in_cat.var_id FROM var_in_cat WHERE var_in_cat.cat_id = (SELECT category.id FROM category WHERE category.nm = "+selectCat+"))");


		}
		
	}
}



thx b4.

===============

try to code, try to win

This post has been edited by izzahaf: 03 May 2009 - 06:27 AM

Was This Post Helpful? 0
  • +
  • -

#3 SixOfEleven  Icon User is offline

  • XNA Developer
  • Icon

Reputation: 402
  • View blog
  • Posts: 5,031
  • Joined: 18-October 08


Dream Kudos: 1250

Expert In: C, C#, XNA, Game Programming, Chocolate

Re: Inconsistency Accessibility

Posted 03 May 2009 - 06:35 AM

View Postizzahaf, on 3 May, 2009 - 06:17 AM, said:

hi all, plz help me
i get error :
Error 1 Inconsistent accessibility: field type 'Skripsi.Data.dbaseConn' is less accessible than field 'Skripsi.GUI.listVariable.dbase' D:\--- m y S c r i p t\Skripsi\Bismillah\GUI\listVariable.cs 15 26 Skripsi


here's my code :

namespace Skripsi.GUI
{
	public partial class listVariable : Form
	{
		public dbaseConn dbase;
		public listVariable()
		{
			InitializeComponent();
			this.dbase = new dbaseConn();
			this.dbase.Open();
		}

	   

		private void listVariable_Load(object sender, EventArgs e)
		{
			
			this.dbase.Connect("SELECT category.nm FROM category");
			try
			{
				while (dbase.variablereader.Read())
				{
					string getvar = dbase.variablereader.GetString(0);
					this.cmbCat.Items.Add(getvar);
				}
			}
			catch
			{
				MessageBox.Show("error on getting variables");
			}

		}
								  

		private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
		{
			string selectCat = this.cmbCat.SelectedItem.ToString();
			this.dbase.Connect("SELECT variable.nm FROM variable WHERE variable.id  IN (SELECT var_in_cat.var_id FROM var_in_cat WHERE var_in_cat.cat_id = (SELECT category.id FROM category WHERE category.nm = "+selectCat+"))");


		}
		
	}
}



thx b4.

===============

try to code, try to win


The error you reporting would seem to me that you've mixed up private/protected/public accessability between the dbaseConn and dbase variables. Try making dbase private instead of public.
Was This Post Helpful? 1

#4 izzahaf  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 1
  • View blog
  • Posts: 104
  • Joined: 12-March 09


Dream Kudos: 0

Re: Inconsistency Accessibility

Posted 03 May 2009 - 06:47 AM

yup.

it's solved, thx vry much . :)
Was This Post Helpful? 0
  • +
  • -

#5 izzahaf  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 1
  • View blog
  • Posts: 104
  • Joined: 12-March 09


Dream Kudos: 0

Re: Inconsistency Accessibility

Posted 03 May 2009 - 06:53 AM

but now, i getting issue in sql query.

Like this : "SELECT variable.nm FROM variable WHERE variable.id" + " IN (SELECT var_in_cat.var_id FROM var_in_cat WHERE var_in_cat.cat_id = (SELECT category.id FROM category WHERE category.nm = "+selectCat+"))"

is "selectCat" tht i take in wrong plce? or any error syntax?

thx. :ph34r:
Was This Post Helpful? 0
  • +
  • -

#6 SixOfEleven  Icon User is offline

  • XNA Developer
  • Icon

Reputation: 402
  • View blog
  • Posts: 5,031
  • Joined: 18-October 08


Dream Kudos: 1250

Expert In: C, C#, XNA, Game Programming, Chocolate

Re: Inconsistency Accessibility

Posted 03 May 2009 - 07:11 AM

View Postizzahaf, on 3 May, 2009 - 06:47 AM, said:

yup.

it's solved, thx vry much . :)


You could click the "This post was helpful link." ;)

Try this link on SQL in C#:

http://www.dreaminco...wtopic31314.htm

This post has been edited by SixOfEleven: 03 May 2009 - 07:07 AM

Was This Post Helpful? 0
  • +
  • -

#7 izzahaf  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 1
  • View blog
  • Posts: 104
  • Joined: 12-March 09


Dream Kudos: 0

Re: Inconsistency Accessibility

Posted 03 May 2009 - 08:56 AM

ok ,,, ok :P

but, wht answer of my quetion above? :D
your link isn't helpfull :D

thx :)
Was This Post Helpful? 0
  • +
  • -

#8 SixOfEleven  Icon User is offline

  • XNA Developer
  • Icon

Reputation: 402
  • View blog
  • Posts: 5,031
  • Joined: 18-October 08


Dream Kudos: 1250

Expert In: C, C#, XNA, Game Programming, Chocolate

Re: Inconsistency Accessibility

Posted 03 May 2009 - 09:05 AM

View Postizzahaf, on 3 May, 2009 - 08:56 AM, said:

ok ,,, ok :P

but, wht answer of my quetion above? :D
your link isn't helpfull :D

thx :)


Is the issue that you don't know how to write a query or that you are getting an exception when your program runs or that you are not getting the results that you expected to get?
Was This Post Helpful? 0
  • +
  • -

#9 izzahaf  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 1
  • View blog
  • Posts: 104
  • Joined: 12-March 09


Dream Kudos: 0

Re: Inconsistency Accessibility

Posted 03 May 2009 - 09:13 AM

i'm getting an exception when the program runs.
like this:
Unknown column 'Agriculture' in 'where clause'

Agriculture is value of selectCat.

this result query is right when i test in query builder.

thx
Was This Post Helpful? 0
  • +
  • -

#10 SixOfEleven  Icon User is offline

  • XNA Developer
  • Icon

Reputation: 402
  • View blog
  • Posts: 5,031
  • Joined: 18-October 08


Dream Kudos: 1250

Expert In: C, C#, XNA, Game Programming, Chocolate

Re: Inconsistency Accessibility

Posted 03 May 2009 - 09:47 AM

View Postizzahaf, on 3 May, 2009 - 09:13 AM, said:

i'm getting an exception when the program runs.
like this:
Unknown column 'Agriculture' in 'where clause'

Agriculture is value of selectCat.

this result query is right when i test in query builder.

thx


I know I'm pestering a little but can you show the query and the table definitions?
Was This Post Helpful? 0
  • +
  • -

#11 izzahaf  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 1
  • View blog
  • Posts: 104
  • Joined: 12-March 09


Dream Kudos: 0

Re: Inconsistency Accessibility

Posted 03 May 2009 - 09:56 AM

View PostSixOfEleven, on 3 May, 2009 - 09:47 AM, said:

I know I'm pestering a little but can you show the query and the table definitions?


this's the query :

"SELECT variable.nm FROM variable WHERE variable.id IN (SELECT var_in_cat.var_id FROM var_in_cat WHERE var_in_cat.cat_id = (SELECT category.id FROM category WHERE category.nm = +"selectCat"+))")

table definition:

-- ----------------------------
-- Table structure for category
-- ----------------------------

DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
`id` int(11) NOT NULL auto_increment,
`nm` varchar(100) collate latin1_general_ci NOT NULL,
`parent_cat_id` int(11) default NULL,
`status` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id`),
UNIQUE KEY `nm` (`nm`),
KEY `parent_cat_id` (`parent_cat_id`),
CONSTRAINT `category_ibfk_1` FOREIGN KEY (`parent_cat_id`) REFERENCES `category` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

-- ----------------------------
-- Table structure for var_in_cat
-- ----------------------------
DROP TABLE IF EXISTS `var_in_cat`;
CREATE TABLE `var_in_cat` (
`id` int(11) NOT NULL auto_increment,
`cat_id` int(11) NOT NULL,
`var_id` int(11) NOT NULL,
`unit_type` varchar(30) collate latin1_general_ci default NULL,
`status` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id`),
UNIQUE KEY `cat_id` (`cat_id`,`var_id`),
UNIQUE KEY `var_id` (`var_id`,`cat_id`),
KEY `unit_type_id` (`unit_type`),
CONSTRAINT `var_in_cat_ibfk_1` FOREIGN KEY (`cat_id`) REFERENCES `category` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `var_in_cat_ibfk_2` FOREIGN KEY (`var_id`) REFERENCES `variable` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

-- ----------------------------
-- Table structure for variable
-- ----------------------------
DROP TABLE IF EXISTS `variable`;
CREATE TABLE `variable` (
`id` int(11) NOT NULL auto_increment,
`nm` varchar(25) collate latin1_general_ci NOT NULL,
`status` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id`),
UNIQUE KEY `nm` (`nm`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;




thx
Was This Post Helpful? 0
  • +
  • -

#12 SixOfEleven  Icon User is offline

  • XNA Developer
  • Icon

Reputation: 402
  • View blog
  • Posts: 5,031
  • Joined: 18-October 08


Dream Kudos: 1250

Expert In: C, C#, XNA, Game Programming, Chocolate

Re: Inconsistency Accessibility

Posted 03 May 2009 - 11:26 AM

View Postizzahaf, on 3 May, 2009 - 09:56 AM, said:

View PostSixOfEleven, on 3 May, 2009 - 09:47 AM, said:

I know I'm pestering a little but can you show the query and the table definitions?


this's the query :

"SELECT variable.nm FROM variable WHERE variable.id IN (SELECT var_in_cat.var_id FROM var_in_cat WHERE var_in_cat.cat_id = (SELECT category.id FROM category WHERE category.nm = +"selectCat"+))")


I think I see your problem. category.nm is varchar. You have to put single quotes around it.

WHERE name = 'Your Name'


Was This Post Helpful? 1
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users