Hi,
my code is very simple.
dim cm as oledbcommand= new oledbcommand("select * from page " ,cn)
cn.open()
Dim dr As OleDbDataReader = cm.ExecuteReader()
dim cate=dr.getstring(1) 'error line"
label1.text=cate
but there is error for dr.getstring(1), the error reads:the data of this
column does not exist:
I am sure the second line exist(not null) and is string type.
when add a read() before the error line,then there is no error. And in
another sub, I can output the same datareader content using a do while
read() function.
Can anyone give me a hint?
Nakhi
From Lijinag,China. 6 4708
Hi
Try with the following code:
RULE: Always call Read before accessing data.
myReader = myCommand.ExecuteReader();
// Always call Read before accessing data.
while (myReader.Read()) {
Console.WriteLine(myReader.GetInt32(0) + ", " +
myReader.GetString(1));
}
HTH
Ravikanth -----Original Message----- Hi, my code is very simple.
dim cm as oledbcommand= new oledbcommand("select * from
page " ,cn) cn.open() Dim dr As OleDbDataReader = cm.ExecuteReader() dim cate=dr.getstring(1) 'error line" label1.text=cate
but there is error for dr.getstring(1), the error
reads:the data of thiscolumn does not exist: I am sure the second line exist(not null) and is string
type. when add a read() before the error line,then there is
no error. And inanother sub, I can output the same datareader content
using a do whileread() function.
Can anyone give me a hint?
Nakhi From Lijinag,China.
.
Hi
Try with the following code:
RULE: Always call Read before accessing data.
myReader = myCommand.ExecuteReader();
// Always call Read before accessing data.
while (myReader.Read()) {
Console.WriteLine(myReader.GetInt32(0) + ", " +
myReader.GetString(1));
}
HTH
Ravikanth -----Original Message----- Hi, my code is very simple.
dim cm as oledbcommand= new oledbcommand("select * from
page " ,cn) cn.open() Dim dr As OleDbDataReader = cm.ExecuteReader() dim cate=dr.getstring(1) 'error line" label1.text=cate
but there is error for dr.getstring(1), the error
reads:the data of thiscolumn does not exist: I am sure the second line exist(not null) and is string
type. when add a read() before the error line,then there is
no error. And inanother sub, I can output the same datareader content
using a do whileread() function.
Can anyone give me a hint?
Nakhi From Lijinag,China.
.
Hi,
you must use Read() in order to populate the reader.
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Hi,
you must use Read() in order to populate the reader.
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
thanx,it works, that is move the cursor to the first line.
Nakhi
Lijiang,Yunnan,China,Asia.
"Natty Gur" <na***@dao2com.com> дÈëÏûÏ¢ÐÂÎÅ
:Ov**************@tk2msftngp13.phx.gbl... Hi,
you must use Read() in order to populate the reader.
Natty Gur, CTO Dao2Com Ltd. 28th Baruch Hirsch st. Bnei-Brak Israel , 51114
Phone Numbers: Office: +972-(0)3-5786668 Fax: +972-(0)3-5703475 Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
thanx,it works, that is move the cursor to the first line.
Nakhi
Lijiang,Yunnan,China,Asia.
"Natty Gur" <na***@dao2com.com> дÈëÏûÏ¢ÐÂÎÅ
:Ov**************@tk2msftngp13.phx.gbl... Hi,
you must use Read() in order to populate the reader.
Natty Gur, CTO Dao2Com Ltd. 28th Baruch Hirsch st. Bnei-Brak Israel , 51114
Phone Numbers: Office: +972-(0)3-5786668 Fax: +972-(0)3-5703475 Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mike |
last post by:
I am trying to use a datareader to retrieve data and set some properties. I
am getting a "Specified method is not supported" error on Line xxx. The data
base is Oracle 9i and the field is a...
|
by: Nakhi |
last post by:
Hi,
my code is very simple.
dim cm as oledbcommand= new oledbcommand("select * from page " ,cn)
cn.open()
Dim dr As OleDbDataReader = cm.ExecuteReader()
dim cate=dr.getstring(1) 'error line"...
|
by: Nakhi |
last post by:
Hi,
I want to display a single record datareader and get a value from it. But I
can't do both together.
After "dim dr as Oledbdatareader=cmCat.ExecuteReader()", the following is
OK(display this...
|
by: Catalin Porancea |
last post by:
Whenever I try this:
____________________________________________________________________
Dim cmd_sp_payments As SqlCommand = New SqlCommand("sp_payments", con)
cmd_sp_payments.CommandType =...
|
by: Lee Walters |
last post by:
Hi All
I'm doing a 'select * from table' in my DataReader below and populating an
array with the results. Obvisouly I'm only getting the first field from the
results by the use of the...
|
by: Agnes |
last post by:
i will select over 30 fieldsname from myTable.
If i use datareader, my way to get the result is (loop - the datareader)
and strResult = myReader.getstring(12) .
Can I use the itemname to get the...
|
by: Goran |
last post by:
I'm a student and I've just started to learn Visual Studio.NET. I have
a project to make a web application.
I have a problem to connect to the database and retriving the PassType
of the...
|
by: nasirmajor |
last post by:
Dear All,
im fetching record from database using datareader, and is displaying
them in the textboxes.
when user change the text fields and then presses the update button the
record should be...
|
by: Cerebrus |
last post by:
Hi all,
Using : .NET 1.1, SQL Server 2000, Win 2K.
Could anyone confirm if there is a bug in the SqlDataReader.GetChars()
method when using CommandBehavior.SequentialAccess to get a BLOB...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |