.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

how to get the value using datareader

Posted By: sheeba     Posted Date: April 26, 2011    Points:5   Category :ASP.Net
Hi

cmd = new OleDbCommand("SELECT PARTNO FROM PARTMACHINE WHERE PARTNO NOT IN(SELECT PARTNO FROM HEADER WHERE BATCH_CODE = '" + Batch_Code + "') AND BATCH_CODE = '" + Batch_Code + "'", oitem.con);
Dr = cmd.ExecuteReader();
while (Dr.Read())
{
parts = Dr["PARTNO"].ToString();
}
Dr.Close();

in this loop i can get the 3 values 001,002,003 like that.now i want to separate using ','..

my o/p should be like this

001,002,003...

and then i need to store this value to one variable bcz i need to use this variable for future purpose.

How to do?

reply fast....

thanks

Responses
Author: Kannan C S             
Posted Date: April 27, 2011     Points: 20   

Hi,

just concatenate
int i=0;
while (Dr.Read())
{
if(i!=0)
parts =parts +","+ Dr["PARTNO"].ToString();
else
parts = Dr["PARTNO"].ToString();
i++
}

Author: kamlesh             
Posted Date: April 27, 2011     Points: 20   

Check Below Link

http://weblogs.asp.net/nannettethacker/archive/2008/02/14/retrieving-values-from-a-datareader.aspx
http://www.shiningstar.net/blog/DataReader.aspx
http://forums.asp.net/t/1198630.aspx/1
http://www.codeproject.com/Answers/127557/how-to-get-value-in-textboxes-from-database-throug.aspx#answer2
http://www.codeproject.com/Messages/3030687/How-to-get-the-values-into-the-textbox-using-datar.aspx
http://www.codeproject.com/Messages/3030700/How-to-get-the-values-into-the-textbox-using-datar.aspx
http://www.codeproject.com/KB/aspnet/Custom_paging_in_ASP_NET1.aspx

Thanks And Regards.
Kamlesh Nikam


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend