473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

'dr' denotes a 'variable' where a 'method' was expected

Dan
I am going through a tutorial, and as far as I can see, have made no typing
errors,
However, the below code gives me the error message:
'dr' denotes a 'variable' where a 'method' was expected<<<

Any ideas???

private void btnStart_Click(object sender, System.EventArgs e)

{

System.Data.OleDb.OleDbDataReader dr;

oleDbConnection1.Open();

dr = oleDbCommand1.ExecuteReader();

while (dr.Read())

{

txtResults.Text += dr("CUSTOMER");

dr.Close();

oleDbConnection1.Close();

}

}
Nov 17 '05 #1
2 2265
change

txtResults.Text += dr("CUSTOMER");

to

txtResults.Text += dr["CUSTOMER"];

"Dan" <da*************@hotmail.com> wrote in message
news:et**************@TK2MSFTNGP15.phx.gbl...
I am going through a tutorial, and as far as I can see, have made no typing
errors,
However, the below code gives me the error message:
'dr' denotes a 'variable' where a 'method' was expected<<<

Any ideas???

private void btnStart_Click(object sender, System.EventArgs e)

{

System.Data.OleDb.OleDbDataReader dr;

oleDbConnection1.Open();

dr = oleDbCommand1.ExecuteReader();

while (dr.Read())

{

txtResults.Text += dr("CUSTOMER");

dr.Close();

oleDbConnection1.Close();

}

}

Nov 17 '05 #2
Dan
Thank you , That did it.
Looks like I found the right group to help learn c sharp!

"Stelrad Doulton" <___@____.com> wrote in message
news:76******************@newsfe2-gui.ntli.net...
change

txtResults.Text += dr("CUSTOMER");

to

txtResults.Text += dr["CUSTOMER"];

"Dan" <da*************@hotmail.com> wrote in message
news:et**************@TK2MSFTNGP15.phx.gbl...
I am going through a tutorial, and as far as I can see, have made no
typing errors,
However, the below code gives me the error message:
>>>'dr' denotes a 'variable' where a 'method' was expected<<<

Any ideas???

private void btnStart_Click(object sender, System.EventArgs e)

{

System.Data.OleDb.OleDbDataReader dr;

oleDbConnection1.Open();

dr = oleDbCommand1.ExecuteReader();

while (dr.Read())

{

txtResults.Text += dr("CUSTOMER");

dr.Close();

oleDbConnection1.Close();

}

}


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: nielson | last post by:
I have a class which contains (1) a class variable and (2) a method (e.g., methodA) which returns a reference to the class variable. If the variable has been assigned a value by a constant...
3
by: Peter Otten | last post by:
QOTW: "Python's a language you can swear by, not at." - Chris "Every sufficiently advanced LISP application will eventually reimplement Python." - Hodgson's Law Chad Himeda asks for a nested...
1
by: David Handy | last post by:
I had a program fail on me today because the following didn't work as I expected: >>> class C: .... def f(self): .... pass .... >>> c = C() >>> m = c.f >>> m is c.f
4
by: ChrisB | last post by:
Hello All: I have created the following field within a class definition: Class User { // fields private RoleInfo roleInfo = RoleInfo.GetRoleInfo(Thread.CurrentPrincipal.Identity.Name);
1
by: jm | last post by:
I have snippets from Form1 and a class named netclass.cs (just an arbitrary name.) Form1 has a textBox1 on it. I want to reference it in the class. I put: static void Main() { ...
2
by: Patrick Olurotimi Ige | last post by:
I converted the code below from VB.NET to C# cos i have to add it to a C# application!! But i'm getting the error:- System.Data.SqlClient.SqlCommand.Parameters' denotes a 'property' where a...
0
by: Ignacio Machin \( .NET/ C# MVP \) | last post by:
I'm getting an error "c:\inetpub\wwwroot\RGSSO\SO.aspx.cs(363): 'RGSSO.WebForm1.dataSetRG' denotes a 'field' where a 'class' was expected" on the following code: private void...
4
by: geeteshss | last post by:
HAI i am actually working in asp.net 1.1 C# with oracle as database and when i wanted to activate edit button to update and cancel the following error occured ...
5
by: Jeremy | last post by:
I've got two projects, both reference system, system.data and system.xml and both include the using System.Xml.Serialization and using System at the top of the file. Both also include the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.