Friday, June 10, 2011
The most simple way to avoid deadlock
Give an order number to each resource (table for example) and use them in every sp in the predefined order.
Thursday, March 31, 2011
XML "database" with C#
1. Step: create class structure for dataset (I'll call it ADS)
2. Step: ADS ads = new ADS(); then init ads
3. Step: serialize
TextWriter writer = new StreamWriter("test.xml");
XmlSerializer serializer = new XmlSerializer(typeof(ADS));
serializer.Serialize(writer, ads);
writer.Close();
4. Step: delete serialize call
5. Step: start using the xml, read all your data in 5 (five) lines
XmlSerializer serializer = new XmlSerializer(typeof(ADS));
FileStream fs = new FileStream("test.xml", FileMode.Open);
XmlReader reader = new XmlTextReader(fs);
ads = (ADS)serializer.Deserialize(reader);
fs.Close();
PS. Don't forget about the try-catch(s), but throw all your oldschool ideas
2. Step: ADS ads = new ADS(); then init ads
3. Step: serialize
TextWriter writer = new StreamWriter("test.xml");
XmlSerializer serializer = new XmlSerializer(typeof(ADS));
serializer.Serialize(writer, ads);
writer.Close();
4. Step: delete serialize call
5. Step: start using the xml, read all your data in 5 (five) lines
XmlSerializer serializer = new XmlSerializer(typeof(ADS));
FileStream fs = new FileStream("test.xml", FileMode.Open);
XmlReader reader = new XmlTextReader(fs);
ads = (ADS)serializer.Deserialize(reader);
fs.Close();
PS. Don't forget about the try-catch(s), but throw all your oldschool ideas
Subscribe to:
Posts (Atom)