|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Retrieving DataTable results programmaticallyI am using DataTable/DataSet in VS 2005, The sql statement is coded in script, i want to know how to retrteve results by changing the SQL commandtext progrmmatically something like this (possibly) dsSearchOperators.Operator.Select("State='CA'"); or using the SQL Statement modified internally like this dsSearchOperators.commandtext = "SELECT * FROM XX where State='CA'"; note 2nd one is fictitious TIA Barry On Tue, 26 Dec 2006 12:28:20 +0530, Barry wrote:
Show quote > Hi If you want to change the sql statement, that will have to be done at the> > I am using DataTable/DataSet in VS 2005, The sql statement is coded in > script, i want to know how to retrteve results by changing the SQL > commandtext progrmmatically > > something like this (possibly) > dsSearchOperators.Operator.Select("State='CA'"); > > or > > using the SQL Statement modified internally like this > > dsSearchOperators.commandtext = "SELECT * FROM XX where State='CA'"; > > note 2nd one is fictitious > > TIA > Barry data adapter level. If, however, you want to filter results that have already been returned, you could use a DataView and set its RowFilter property to filter the data Hi Barry,
If "State" is the field that will always be checked and the only variable portion is 'CA' then you can use a parameterized query: Data Access in Client and Middle-Tier Programming How to: Create Parameterized TableAdapter Queries http://msdn2.microsoft.com/en-us/library/ms171905(VS.80).aspx Data Access in Client and Middle-Tier Programming How to: Add a Parameterized Query to a Form in a Windows Application http://msdn2.microsoft.com/en-us/library/aeez5k4f(vs.80).aspx Show quote "Barry" <some***@somewheer.com> wrote in message news:%23rvx8sLKHHA.1248@TK2MSFTNGP02.phx.gbl... > Hi > > I am using DataTable/DataSet in VS 2005, The sql statement is coded in > script, i want to know how to retrteve results by changing the SQL > commandtext progrmmatically > > something like this (possibly) > dsSearchOperators.Operator.Select("State='CA'"); > > or > > using the SQL Statement modified internally like this > > dsSearchOperators.commandtext = "SELECT * FROM XX where State='CA'"; > > note 2nd one is fictitious > > TIA > Barry > |
|||||||||||||||||||||||