XML and Dataset

F

Franck

I load XML inside Dataset. I normally use the SQL database but the
user can go in offline mode which create XML file on the HD. I load
them with no problem, now the problem is the request i was using to
query the table have to be done in XML also. How can you sort on a
field substring.


ORIGINAL SQL STATEMENT
string LoadSQL = "SELECT UnitNumber, Options, Value FROM
ModelSelection_Data WHERE (JobId = " + ModelSelectionGlobal.JobID + ")
AND (Revision = " + ModelSelectionGlobal.RevisionID + ") AND (Quantity
= " + ModelSelectionGlobal.NumberOfUnits + ") AND (Options = 'A3' OR
Options = 'A7' OR Options = 'Z1' OR Options = 'Z3' OR Options = 'Z4')
ORDER BY UnitNumber, LEFT(Options, 1), CONVERT(int, RIGHT(Options,
LEN(Options) - 1))";

THIS IS THE XML ONE
i loaded the XML which contain all the record on the table (+/- 600
records) now i need to do my sql statement on it.
Later with other request ill need to do Union query on the dataset i
need to find a way to make that work also.

dsLoadData.Tables[0].Select("JobId = " + ModelSelectionGlobal.JobID +
" AND Revision = " + ModelSelectionGlobal.RevisionID + " AND Quantity
= " + ModelSelectionGlobal.NumberOfUnits + " AND (Options = 'A3' OR
Options = 'A7' OR Options = 'Z1' OR Options = 'Z3' OR Options =
'Z4')", "UnitNumber, LEFT(Options, 1), CONVERT(int, RIGHT(Options,
LEN(Options) - 1)");

that doesn't work because of the convert wich is SQL statement and not
dataset sorting statement.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

You will have to use the data stored in the dataset to filter it. DataView
has a good number of options to allow you do that.

Take a look at the docs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top