|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to query the table in a dataset?I am using vs2003,
How can I do the job like select studentID from student where studentName='Jay' Do I need to iterate the datatable of the dataset row by row? Or I can query it? Cylix,
This is the most simple AdoNet there is. There are probably hundreds of solution for this, therefore can you tell something more. Basicly you can use a DataReader, a DataAdapter(which uses a datareader) or a TableAdapter (which is an inherited datadapter), those standard in the tasts for Oracle, for SQLClient or for OleDB. So can you write something more what is the goal from this select? Cor Show quoteHide quote "Cylix" <cylix2***@gmail.com> schreef in bericht news:1155523039.660052.126700@74g2000cwt.googlegroups.com... >I am using vs2003, > How can I do the job like > select studentID from student where studentName='Jay' > Do I need to iterate the datatable of the dataset row by row? > Or I can query it? > Cylix,
I see that I have misread your question. In my idea is the simplest answer on your question. Datatable.defaultview.rowfilter = "studentName = Jay" Both a select and this one returns a table however the dataview (what is this above) is about the original table. You can access this table now by Datatable.defaultview I hope this helps, Cor Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schreef in bericht news:OdoMMv2vGHA.4688@TK2MSFTNGP06.phx.gbl... > Cylix, > > This is the most simple AdoNet there is. > > There are probably hundreds of solution for this, therefore can you tell > something more. > > Basicly you can use a DataReader, a DataAdapter(which uses a datareader) > or a TableAdapter (which is an inherited datadapter), those standard in > the tasts for Oracle, for SQLClient or for OleDB. > > So can you write something more what is the goal from this select? > > Cor > > "Cylix" <cylix2***@gmail.com> schreef in bericht > news:1155523039.660052.126700@74g2000cwt.googlegroups.com... >>I am using vs2003, >> How can I do the job like >> select studentID from student where studentName='Jay' >> Do I need to iterate the datatable of the dataset row by row? >> Or I can query it? >> > > Hi,
You can use datatable.select to find a record with its primary key. Dataview.find will return the row number on a sorted column. http://msdn2.microsoft.com/en-us/library/h71xaeh0.aspx http://msdn2.microsoft.com/en-us/library/18kktzs4.aspx Ken ------------------------ Show quoteHide quote "Cylix" <cylix2***@gmail.com> wrote in message news:1155523039.660052.126700@74g2000cwt.googlegroups.com... >I am using vs2003, > How can I do the job like > select studentID from student where studentName='Jay' > Do I need to iterate the datatable of the dataset row by row? > Or I can query it? > Cylix wrote:
> I am using vs2003, In 2005 (not sure about 2003) results can be filtered via> How can I do the job like > select studentID from student where studentName='Jay' > Do I need to iterate the datatable of the dataset row by row? > Or I can query it? DataTable.Select(). B. |
|||||||||||||||||||||||