Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2004, 06:10 PM
Registered User
 
Join Date: Sep 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Against DataSet?

Hello,

I'm new to .NET, but have enough experience with ASP/ADO to be dangerous. I have a client-side DataSet created from an XML file, consisting of several tables, constraints, relationships... all very nice. Now, how can I do SQL against it? As I understand it, I need a SqlConnection object to do that, but a SQLConnection results in a DataSet - I already have the DataSet and need to manipulate it as if it were a regular database. I'm sure I'm missing something here - any advice?

Thanks



Jim Stanley
Media Services, Inc.
 
Old September 2nd, 2004, 08:56 PM
Authorized User
 
Join Date: Jul 2004
Posts: 69
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can do a DataTable.Rows.Select( "field=value and field2=value2" ) which returns an array of DataRows according to your Statement. Nothing too complex though. Really just a filter. If you need to do more complex SQL statements on the data it should probably be done through Stored Procedures or your initial call to the database.

FYI, if you are using ASP.NET, all DataSets are on the server side. To my knowledge, there really isn't such a thing as a "Client-side" DataSet in ASP.NET. In ADO, as opposed to ADO.NET, there were cursors which designated a client side or server side, but this is no longer the case. By default, the data is taken from the database and held in memory inside the dataset until it is disposed of.

If you are looking for a more active connection to the data, the DataSet is populated behind the scenes by the DataReader. In SQL Server, it is the SqlDataReader. It provides a more ADO feel for a cursor location and whatnot.

Hope this helps.

www.CoderForRent.com
Get A Computer Job!
 
Old October 10th, 2004, 12:16 AM
Friend of Wrox
 
Join Date: Feb 2004
Posts: 177
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can also define relationships to get Parent Data, Child data dn loop through it. You can use the following link to learn how to do it

http://msdn.microsoft.com/library/de...tRelations.asp



It is not how much we do,
but how much love we put in the doing.

-Mother Theresa





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using SQL together with DataSet? jacob C# 5 August 12th, 2008 02:25 AM
dataset and sql query notification p2pMember ASP.NET 2.0 Professional 1 September 26th, 2007 07:22 PM
Re: SQL Server dataset to ACCESS dataset dazzer ADO.NET 0 March 22nd, 2004 05:28 AM
update table (SQL & DataSet) melvik ADO.NET 1 July 24th, 2003 04:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.