Ask a Question related to ASP.NET General, Design and Development.
-
Nakhi #1
datareader.getstring(0) error
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.
Nakhi Guest
-
opengl: What happened to GetString?
hi, on ruby173 and previous this worked: GL.GetString( GL::VERSION) but with 180-10 i am getting this error message: :in `GetString': NULL... -
encoder.GetString() help
I have tried the following to convert an encrypted byte() into a string to write it to a database: Dim encoding as new UTF8Encoding() Dim EncNum... -
inserting option values into drop down lists with getstring when using distinct in the SQL
I don't know what your problem is. It works fine for me. Here is my code: <% dim cn,rs set cn=server.CreateObject("adodb.connection") ... -
getstring really slow
Hi, Hope somebody can help because i've looked everywhere else fo ran answer. I'm connecting to an Access table with 100+ rows of data of approx... -
can't getstring & display datareader
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... -
Ravikanth[MVP] #2
datareader.getstring(0) error
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
page " ,cn)>-----Original Message-----
>Hi,
>my code is very simple.
>
>dim cm as oledbcommand= new oledbcommand("select * fromreads:the data of this> 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 errortype.>column does not exist:
>I am sure the second line exist(not null) and is stringno error. And in>
>when add a read() before the error line,then there isusing a do while>another sub, I can output the same datareader content>read() function.
>
>Can anyone give me a hint?
>
>Nakhi
>From Lijinag,China.
>
>
>.
>Ravikanth[MVP] Guest
-
Natty Gur #3
Re: datareader.getstring(0) error
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 [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Nakhi #4
Re: datareader.getstring(0) error
thanx,it works, that is move the cursor to the first line.
Nakhi
Lijiang,Yunnan,China,Asia.
"Natty Gur" <natty@dao2com.com> дÈëÏûÏ¢ÐÂÎÅ
:OvLkJvgSDHA.1912@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 [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Nakhi Guest



Reply With Quote

