C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » ADO.NET »

Get Multiple records using DataTable.Select.


Posted Date: 25 Oct 2008    Resource Type: Code Snippets    Category: ADO.NET
Author: Varun BansalMember Level: Gold    
Rating: 1 out of 5Points: 10



OleDbConnection myConnection = new OleDbConnection("Provider=SQLOLEDB.1;Data

Source=localhost;database=northwind;User Id=sa;Password=;");
OleDbDataAdapter myda= new OleDbDataAdapter ("Select * from Orders", myConnection);
System.Data.DataSet ds= new DataSet ();
myda.Fill (ds,"table");

DataRow[] dr ;
string id ="ROMEY";// "Field with id ROMEY has more than one records found
string sel ="customerid='"+ id + "'";
dr = ds.Tables [0].Select (sel);
int i;
for(i=0;dr.read();i++)
{
Response.Write (dr[i]["Orderid"].ToString() + "\t" +
dr[i]["Customerid"].ToString() + "\t" + dr[i]["Freight"].ToString () +
"
");




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Ues of DataTable.select statment.  .  Select specific records from datatable.  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: View records one by one from ds on click of buttons
Previous Resource: MySql and Ado.Net
Return to Discussion Resource Index
Post New Resource
Category: ADO.NET


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use