|
-
Nov 28th, 2007, 08:33 PM
#1
Thread Starter
New Member
execute sql command with xml file
hi guys!
i am beginning with xml document.and i have a question:
how can i execute a sql query with a DataTable in xml document
thanks alot !
-
Nov 28th, 2007, 09:07 PM
#2
Re: execute sql command with xml file
You'll have to explain that a bit more clearly. Are you saying that you have an XML file containing a serialised DataTable? Where's the query?
-
Nov 29th, 2007, 10:42 PM
#3
Thread Starter
New Member
Re: execute sql command with xml file
i've back
please help me!
as you said. i have an xml file named test.xml:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<doc>
<song>
<id>1</id>
<name>Unbreakable</name>
<artist>Westlife</artist>
</song>
<song>
<id>2</id>
<name>ShowMeTheMeaningOfBeingLonely</name>
<artist>B.S.B</artist>
</song>
</doc>
so i have a datatable named: 'song' in this file.
then in my program,i use these statements:
Code:
DataSet ds = new DataSet();
ds.ReadXml("test.xml");
DataTable da = new DataTable();
da = ds.Tables["song"];
now i want to execute many sql commands with this datatable.
if it is an access database or sql database,i would use oledb or ado.net
but now it is an xml file.
please help me!
thanks!
-
Nov 29th, 2007, 10:52 PM
#4
Re: execute sql command with xml file
You are mistaken. You would use OleDb or SqlClient to execute an SQL query to retrieve data from Access or SQL Server into a DataTable. You've already got a DataTable. If you want to filter a Datatable then you can either call its Select method or set its DefaultView.RowFilter property. Unless you're using .NET 3.x and LINQ though, you can't actually query a DataTable.
-
Nov 29th, 2007, 11:45 PM
#5
Thread Starter
New Member
Re: execute sql command with xml file
i see what you said.
before,i believed that there is a Class in .net to help me connect with xml database and manipulate with it easily,and can execute sql commands.
thanks.
-
Nov 30th, 2007, 03:45 PM
#6
Re: execute sql command with xml file
Indeed, and jmcilhinney has already hinted at it - XLINQ
Slightly less verbose example
You'll need Visual Studio 2008 - the Express editions are free
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|