Remember as it is a loop only one value will be in the label.
as you are reassigning.
Consider print  to response stream.

"but in c# it displayes only last row "
This is not with c# this is with all languages with the logic you apply.

label1=x
label1=y

what is label1 now ? this is what you do .
You must trace the code and check what it does step by step , better make
familiar with debugging

:)

On Thu, Apr 23, 2009 at 2:21 PM, vikas arora <[email protected]>wrote:

> hi
> i need to display database content through labels
>
> in place of variabels.
>
>
> On Thu, Apr 23, 2009 at 2:17 PM, Jaswinder <[email protected]> wrote:
>
>>
>>  Vikas What you realy wants to do..??
>>         explane it
>>
>> but you can also go for
>>
>> **
>>
>> string s1 = "";
>>
>> *string s2 = ""; *
>>
>> *while* (dr.Read)
>>
>> {
>>
>>         s1 = dr[0].ToString();
>>
>>         s2 = dr[1].ToString();
>>
>>         Response.Write( s1 + "            "+s2+ "<br>")
>>
>> }
>>
>>
>>
>> *JONY GREAT*
>>
>> *tech-prastish.com
>> CELL NO:9872471054*
>>  ------------------------------
>>
>>
>>  ------------------------------
>> *From:* vikas arora <[email protected]>
>> *To:* [email protected]
>> *Sent:* Thursday, 23 April, 2009 12:57:59 PM
>> *Subject:* [DotNetDevelopment] Re: regarding datareader or dataset
>>
>> hai all,
>>
>> sorry jaswinder, in place of label i m using variabels
>>
>> while dr.Read
>>
>> dim s1,s2 as string
>>
>> s1=dr(0).ToString()
>> s2=dr(1).ToString()
>>
>> Response.Write(s1)
>> Response.Write(s2)
>> Response.Write("<br>")
>>
>> End While
>>
>>
>> & i need labels to show the result in place of variabels.
>>
>> Plz Help
>>
>> On Thu, Apr 23, 2009 at 11:59 AM, Jaswinder <[email protected]>wrote:
>>
>>>
>>>   Vikas,
>>>   Your Code will give same output in vb...
>>> Are you tryied  ?
>>>
>>> Now You can Try To Do Your Task :
>>>
>>>   *while* (dr.Read())
>>>
>>>     {
>>>
>>>         label1.Text += dr[0].ToString();
>>>
>>>         label2.Text += dr[0].ToString();
>>>
>>>         Response.Write("</ br>");
>>>
>>>     }
>>>
>>>
>>>
>>> Regards,
>>>
>>>
>>>
>>> *JONY GREAT
>>> *
>>>
>>> *tech-prastish.com*
>>>
>>> *CELL NO:9872471054*
>>>  ------------------------------
>>>
>>>
>>>  ------------------------------
>>> *From:* vikas arora <[email protected]>
>>> *To:* [email protected]
>>> *Sent:* Thursday, 23 April, 2009 11:40:22 AM
>>> *Subject:* [DotNetDevelopment] regarding datareader or dataset
>>>
>>> hi all,
>>> i m a vb.net programmer
>>> now i need to create a page in c#
>>>
>>> in vb.net when we need to retrieve the value in label from datareader we
>>> apply
>>>
>>> While dr.Read
>>>
>>> label1.Text= dr(0).ToString()
>>> label2.Text= dr(0).ToString()
>>> Response.Write("<br>")
>>>
>>> End While
>>>
>>> & the following code retrieve all the values from the database
>>>
>>> but in c# it displayes only last row
>>>
>>> plz help
>>>
>>> Thanx
>>> ----------
>>>
>>> ------------------------------
>>> Explore your hobbies and interests. Click here to 
>>> begin.<http://in.rd.yahoo.com/tagline_groups_6/*http://in.promos.yahoo.com/groups/>
>>>
>>> ------------------------------
>>> Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo!
>>> Edition * Click 
>>> here!<http://in.rd.yahoo.com/tagline_firefox_1/*http://downloads.yahoo.com/in/firefox/>
>>>
>>
>>
>> ------------------------------
>> Bollywood news, movie reviews, film trailers and more! Click 
>> here.<http://in.rd.yahoo.com/tagline_movies_1/*http://in.movies.yahoo.com/?wm=n/>
>>
>
>


-- 
My Web Site
http://everlovingyouth.googlepages.com
My Technical Blog
http://acutedeveloper.blogspot.com
Skype :santhoshnta
Orkut :everlovingyouth

Reply via email to