CREATE TABLE dbo.Txml
(
brRacuna int NULL,
korisnickoime varchar(50) NULL,
xmldata xml NULL
)
I need to write xml file into column xmldata and aslo read data from this column using linq query
I need realy help thanks in advance
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Guest UserRank #259 · 9.8K reputationPosted Jul 31, 2014, 3:16 AM EDT
var xmlFile = System.IO.ReadFile("xml.dat")
now store this xmlFile into sqlserver column
# While you're reading it back you can use it in same fashion , e.g.,
var sqlOutput = db
miroslav nikolic10 reputationPosted Aug 1, 2014, 1:07 AM EDT
DataClasses1DataContext Pro = new DataClasses1DataContext();
XElement xlinq = new XElement("ProizvodUkorpi",
from p in Pro.ProizvodUkorpis
where p.korisnickoime == korime
select new XElement("proizvod",
new XElement("naziv", p.naziv),
new XElement("kolicina", p.kolicina),
new XElement("cena", p.cena),
new XElement("iznos", p.iznos)
)
);
Txml nov = new Txml();
nov.xmldata = xlinq;
nov.korisnickoime = korime;
Pro.Txmls.InsertOnSubmit(nov);
Pro.SubmitChanges();
One more thanks on your time and help
Guest UserRank #259 · 9.8K reputationPosted Aug 1, 2014, 1:08 AM EDT