Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# XML SQL Server
Hi all,
 
I get a lot of web site assignments in C# to go through, using connections to various flavours of the MS Sql database types (Sql Server, Express, CE, etc). For my basic-level students, setting up Sql server (any edition) is tedious work and often problematic.
 
I'm thinking that there must be an alternative. For testing, and for low-traffic web sites, I'm thinking of saving tables and their data as XML files (or the like), which could be saved with the project. However, these files should not be connected to via an XMLDataSource, but via an equivalent to the regular SqlDataSource, only that this new datasource translates to and fro an XML document.
 
In other words, what I am looking for is a way to create, update, delete, and read from tables and sql queries as usual, only that everything is stored as text files (possibly in XML format). This would really help when teaching and also grading assignments (or so I hope). Regardless whether this idea sounds stupid or not, I wonder if anyone knows if there already exists applications or Visual Studio add-ons for this kind of feature, and if not, if this "realtime translator" would at all be possible to code and include in Visual Studio.
 
Love to all,
 
Pettrer
Posted 22-Mar-13 14:03pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

"Setting up" Sql Server CE can be as simple as providing the DLLs, so I'd recommend that first.
 
Might it be possible to wrap an XMLDataSource in an SqlDataSource? (I've never used one.)
 
I would not try to implement a full SQL engine, but I suppose a small subset could be implemented in a weekend -- with VS or otherwise. It could be educational.
 
I suspect you'd have to master XPath in order to implement WHERE clauses.
  Permalink  
Comments
petter2012 at 23-Mar-13 14:41pm
   
Hi, Thanks for your reply. Yes, I think as well that this could be done rather quickly (for educational purposes only). What I'd like to be able to do is to, say, display news and perhaps select something from table A where the ID = the ID in another table.
 
I'm still thinking on how to implement the engine. I guess I could write a class in C# which simply parses the XML-ish text, and hook up methods to the ten (or so) most commonly used SQL statements. Rather interesting, really! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 406
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 205
3 Raul Iloc 170
4 Maciej Los 164
0 OriginalGriff 8,289
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,624
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 22 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100