Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataSet = Dataview

Status
Not open for further replies.

cupcakesrule

Programmer
Feb 6, 2007
35
US
Is it possible to set a dataset equal to a dataview?
 
Well I am trying to write an XML file and want to utilize the datasets.WriteXml method. But I have a dataview that is created from a datatable that I need in order to filter the rows. So I want to use the information from the dataview to write and XML file. Is there anyway to utilize the .WriteXml method with the information from the dataview?
 
Where does the DataView come from originally?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I pull information from a couple tables in SQL server with a datareader. And the table is not set up very well so there are multiple date fields that depend how far a client got in an application. So I have to use a datatable to combine the given date into one field. I then set the dataview equal to the datatable so I can filter the rows, and I want to take the dataview and somehow utilize the .WriteXml method.
 
Even if the SQL Database isn't "set up very well" there's nothing stopping you from writing the SQL statement (or Stored Procedure ideally) from returning the correct results. This is where the work should be done as returning incorrect results from a SQL statement and manipulating them on the client is quite simply backwards!

Once you get the correct results, you won't have to worry about DataViews as you can read the results straight into the DataSet.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Well the database has 10 smallint fields with corresponding dates that only get set if the smallint field has been changed from 0. So I have to go through and for each record find the last smallint field not set to zero with the next small int is set to 0 and then pull that date for my date field. And then I have to filter according to this specific date. Any ideas on how to do this?
 
Yes, as I said above in either the SQL statement or a Stored Procedure. The latter will be better and make it easier.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top