save the information from an xml in sql

hi all. I need to save the mass information from an xml in 
sql database from c # is not how. thanks
-- 
desarrollo
0
Utf
3/1/2010 7:48:01 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

5 Replies
633 Views

Similar Articles

[PageSpeed] 51

On 01-03-2010 14:48, paulcc84 wrote:
> hi all. I need to save the mass information from an xml in
> sql database from c # is not how. thanks

Do you want to parse the XML on the C# and insert
normal database types or do you want to have SQLServer
handle the XML?

Arne

0
UTF
3/2/2010 12:33:43 AM
want to parse the XML on the C# and insert
normal database type
-- 
desarrollo


"Arne Vajhøj" wrote:

> On 01-03-2010 14:48, paulcc84 wrote:
> > hi all. I need to save the mass information from an xml in
> > sql database from c # is not how. thanks
> 
> Do you want to parse the XML on the C# and insert
> normal database types or do you want to have SQLServer
> handle the XML?
> 
> Arne
> 
> .
> 
0
Utf
3/2/2010 1:24:03 PM
On 02-03-2010 08:24, paulcc84 wrote:
 > "Arne Vajhøj" wrote:
>> >  On 01-03-2010 14:48, paulcc84 wrote:
>>> >  >  hi all. I need to save the mass information from an xml in
>>> >  >  sql database from c # is not how. thanks
>> >
>> >  Do you want to parse the XML on the C# and insert
>> >  normal database types or do you want to have SQLServer
>> >  handle the XML?
 > want to parse the XML on the C# and insert
 > normal database type

Load the XML into a XmlDocument amd walk through it via
the good old GetElementsByTagName or the more modern
XPath SelectNodes assign the extracted values to
parameter values for SqlCommand INSERT statements.

(you could also use LINQ, but I doubt there will be
any benefits in this case)

If gave an example of XML then I may even provide a
small example of code.

Arne
0
UTF
3/2/2010 11:39:44 PM
"paulcc84" <paulcc84@gmail.com> wrote in message 
news:D13E8CE3-64E4-47C5-B89D-F01E22A70EFF@microsoft.com...
> want to parse the XML on the C# and insert
> normal database type
> -- 
> desarrollo
>
>
> "Arne Vajhøj" wrote:
>
>> On 01-03-2010 14:48, paulcc84 wrote:
>> > hi all. I need to save the mass information from an xml in
>> > sql database from c # is not how. thanks
>>
>> Do you want to parse the XML on the C# and insert
>> normal database types or do you want to have SQLServer
>> handle the XML?
>>
>> Arne
>>
>> .
>>
I'm working with xml at the moment.
Here's a snippet, I've fiddled with it a bit to try and make it clearer what 
it does.
I'm inserting into a datatable but you could stick whatever object there or 
foreach a list or whatever.
My XML file is as flat as a file you'd ever find.


                XDocument xd = XDocument.Load("file.xml");
                var q = from c in xd.Descendants("xmlroot")
                        orderby (Int32)c.Element("ColID")
                        select c;
                 DataTable dt = ds.Tables[0];
                 foreach (var c in q)
                 {
                     DataRow row = dt.NewRow();
                     row["ColID"] = (Int32)c.Element("ColID");
                     row["FieldName"] = (String)c.Element("FieldName");
                     row["SeeInGrid"] = (Boolean)c.Element("SeeInGrid");
                     row["ColOrder"] = (Int32)c.Element("ColOrder");
                     row["DataType"] = (String)c.Element("DataType");

                     row["ColHeading"] = (String)c.Element("ColHeading");
                     row["ColWidth"] = (String)c.Element("ColWidth");
                     dt.Rows.Add(row);
                 } 

0
Andy
3/3/2010 9:42:55 AM
If you want to "shred" the xml............here is a link:
http://pratchev.blogspot.com/2007/06/shredding-xml-in-sql-server-2005.html

You can pass down the xml via the "XML" datatype (in tsql)....or if you're 
at Sql Server 2000, the "text" datatype.  Note, Sql Server 2000 has an older 
OPENXML function.

See
http://support.microsoft.com/kb/315968
for a VERY OLD (and showing its age) example.

Do NOT use OPENXML with 2005,2008 or later.




"paulcc84" <paulcc84@gmail.com> wrote in message 
news:E44E12B2-0D46-4EF1-9D3F-D71B4CC7539B@microsoft.com...
> hi all. I need to save the mass information from an xml in
> sql database from c # is not how. thanks
> -- 
> desarrollo 


0
sloan
3/4/2010 9:26:45 PM
Reply:

Similar Artilces:

SQL Reporting Services and GP 10
Hello: Is it possible to associate SQL Reporting Services reports with SOP invoices in GP 10.0 rather than with Report Writer? I know that Accountable Software has Forms Printer, but I believe that that only works with Crystal. And, I know that there are SRS reports written to display data from GP but I do not think that these reports will work in terms of printing invoices or orders from SOP. Thanks! childofthe1980s No not really.. The problem is that when an SOP or POP document is printed, GP needs to be updated. Accountable does that with their Crystal interface but I dont kno...

install sp1 on sql 2008 r2
Hi, i'm a bit confused. I just installed sql 2008 r2 (build 1600) and i need to install the SP1 but my doubt is, what is sql 2008 R2? is it sql 2008 + Service Pack 1? what update does it include with the "r2"? do i have to install sp1 or it's already included? thanks!! R2 is like a whole new version of 2008. Actually a half version :). It was just released so all there is to load is the RTM version. There are no service packs for it yet. -- Andrew J. Kelly SQL MVP Solid Quality Mentors "iNewbie" <iNewbie@discussions.microsoft.com>...

Excel user information
I am interested in learning about who uses Excel and how they use it. For example, what percentage of users have had formal training; how many use VLookup, or how many build models from scratch. Does anyone know of a source for such information? Thanks. Steve Powell No idea where you would get official stats, if indeed they even exist (Which i doubt), but happy to give you my personal guess:- Formal Training - Less than 1% Use VLOOKUP - Less than 10% Build Models - Depends on definition of what a model is. A couple of cells of data with a formula could be construed as a model, so I...

excel save hangs
Hi, I have a spreadsheet that hangs when I save it after opening. I have tried the following with no success: 1. save as 2. copy to another directory and save there 3. copy to another PC. I noticed that everytime I save a strange file gets added to the directory and the excel program ends up using 100% cpu. Other spreadsheets do OK. This one is different in that the columns got populated from a database query; but I don't know if that's relevant. Same results on XP and Windows 2000. Ideas anyone? Thanks. Maria Maria, Try changing the data range properties so ...

Find and Replace within an XML file
I was wondering if there is a simple method of replacing characters within the xml document. I'm looking at writing a Biztalk Pipeline that escapes illegal characters before they are processed by a HL7 assembler. I.E. replace all instances of &amp; or & with \T\ . I thought about converting to a string and using the replace function, but that would mean knownig all the HTML codes for characters (as the escape characters are to be dynamically chosen by the user). Where as I could via xpath ??? replace all instances of the original character such as &. Hope it makes sen...

Can't save over share
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I have had Office 2008 for awhile now and I haven't come across this unusual bug until recently. The problem occurs when trying to save an xlsx file over a samba share. All other formats save fine i.e xls, doc, docx, pptx, etc. What will happen is it will try to save as an .xlsx file then a message box appears saying, &quot;Microsoft Excel cannot access the file 'share: [string of random numbers and letters]. The odd thing that I have stumbled upon is that this doesn't occur if I set an open pass...

How to Read/Write ADO.NET DataSet XML file without .Net runtime in VC6/VB6?
The ADO.NET DataSet XML file is used in our system, But I want use VC6/VB6 to Read and Write the XML data file, Where can find the C++/MFC/ActiveX tools for VC6/VB6? thanks! http://gnonug.xocomp.net/Support/FAQ/551.aspx Transform ADO.NET DataSet to ADO Recordset Best Regards Onega www.fruitfruit.com "jiatiejun" <jiatiejun@126.com> wrote in message news:#m8vcOa2DHA.3436@tk2msftngp13.phx.gbl... > The ADO.NET DataSet XML file is used in our system, > > But I want use VC6/VB6 to Read and Write the XML data file, > > Where can find the C++/MFC/ActiveX tools f...

Xml into Dataset #2
Hi All; I'm reading the following xml file into a Dataset but there are only 4 datatables in my dataset (which should be 5) Is that because I have two nodes with the same name (detail) in my xml file? how can I fix this? Thanks for your time. <?xml version="1.0" ?> - <report> - <subreport> - <header> <sales_order>S218575</sales_order> </header> - <detail> <sod_part>776545995278</sod_part> <batch_code /> <input_qty /> &...

Getting information from strings
Hi, I have created a database which takes the audit history of tickets, and stores it in a memo field. I have some code which will examine this field to find the first team that a ticket was assigned to, however I have a requirement to build an "assignment history". This history should consist of each team in turn that the ticket was assigned to, which will be output to a text file (I have written code for outputting to the file). I have tried using left$ and right$ to no avail, so any advice I could get would be great. For information, every time a ticket is assigned, an ...

Save and Close Error in accounts and contacts
Hi - Just upgraded to CRM 4 and am noticing an error when accessing via the web: When I his either save and close or save and new in an account or a contact I get an error popup - "Microsoft Dynamics CRM has encountered an error Please tell Microsoft about this problem..... The XML report that is sent to MS is as follows: Microsoft Dynamics CRM Error Report Contents <CrmScriptErrorReport> <ReportVersion>1.0</ReportVersion> <ScriptErrorDetails> <Message>Syntax error</Message> <Line>106</Line> <URL>/ORG NAME/sfa/conts/...

Trouble Reading XML string
I have a method that generates an string in XML format and passes it to be processed. The string is in the following format: <grandparent> <parent> <child1>text</child1> <child2>text again</child2> </parent> <aunt> <cousin1>text</cousin1> <cousin2>text2</cousin2> <cousin3>text4</cousin3> </aunt> </grandparent> string xmlInput = <values above> XPathDocument xpDoc = new XPathDocument(new StringReader(xmlInput)); XPathNavigator xpNav = xpD...

MSPersisted XML ...
I have an ADO Persisted XML file. I have a couple of XML files, 1) containes single Schemas in it and I can load this perfectly using MSPersist 2) Containes multiple Schemas and when I try to load this, ADO only sees the first schema. How do I handle an XML file with multiple schemas ? What is the best way to read this in VB.NET or C# ? Are there any examples please ? Thanks, Michael ...

Viewing xml created in .Net in a ASP form VB6
I have been trying to create an xml document in VB.Net for displaying on an existing page written in ASP. im having a type mismatch error in my code. When i view my XML i have the following included in the <binary> node. <Binary xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">DATA HERE </Binary My issue is how do i set the datatype of the the node using dotnet so that i can replicate the same node structure and use my existing ASP page. thanks in advance Colin Graham ...

save files in FTP folder
Can I save the Outlook files on a FTP folder and have outlook 2003 access those files as defoult? Close Outlook - then cut and paste the outlook.pst file to the location of your choice. Reopen Outlook and when it whines, point it to the location of the saved .pst file. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the Swen virus, all e-mails sent to my actual account will be deleted w/out reading. After searching google.groups.com and finding no answer Wilson <wdgouveia@hotmail.com> asked: | Can I save the Outlook files on a ...

is it possible to host multiple CRM databases on 1 SQL server?
Hi, Is it possible to host two separate (on premise) CRM server databases on one SQL server? I am trying to achieve the above scenario, but there can only be one MSCRM_config database on any one instance of the SQL server. The Implementation guide isn't too clear about what to do in this situation. - Can two CRM databases share the same MSCRM_config file? - Do I need to install another instance of SQL server for the second CRM database? Or is there another solution? Thanks Depends on your CRM installation. If you are running the Enterprise version, then you can add a new org...

xml serialization over a NetworkStream
I'm trying to set up something to stream objects serialized into xml from one end of a tcp connection to the other. To that end, I've gotten a connection working without too much fuss. However, when I serialize an object into a NetworkStream on one end and then try to deserialize it on the other, nothing happens. The sender acts as though the serialization went off without a hitch, but the receiver never gets it. After some research, I've found that closing the stream will cause the receiving end to get and deserialize the object properly. But that CAN'T be the best...

saving a array to disk
i am a old bloke trying to teach myself to program. i sish to save a 3 demensional aray (structur and data) to disk and return it at a later date from a diferent module usingvba in access 2003. i have read of openfile,put and get but i am having truble puting them together can sombody give me a example On Thu, 7 Jan 2010 04:54:01 -0800, cliff <cliff@discussions.microsoft.com> wrote: >i am a old bloke trying to teach myself to program. >i sish to save a 3 demensional aray (structur and data) to disk and return >it at a later date from a diferent module usingvba in...

Saving emails on the server for 2 computers
We have two computers connected with a router and both have Windows XP home edition on them. Now my desktop I use Outlook Express for emails and I have it set up to save messages on the server until I delete same. That way I can receive emails on both computers. On the laptop I use Microsoft outlook for emails and if I go in and read the emails they automatically delete them from my server and I cannot retrieve them on my desktop in Outlook Express. So. I have tried going into Microsoft outlook on the laptop and gone into, tools, account settings, data files and then I'm lost on ...

Information Store Stops Unexpectidly
All, We currently have an exchange 5.5 with SP4. I am recieving errors 3039, 4182, 4116. When this happens the Information Store and IMC shuts down. Not getting much direction from microsoft. Any help would be greatly appreciated. Thanks, Jim Jim, There are usually two reasons you'll get those error messages. The first is that your Internet Mail Service is damaged (unlikely), and the second (more likely) is that you have a corrupted message that needs to be deleted. You'll want to take a look at this KB Article, as I think it will solve your problem. http://support.m...

Emails saved to network drive
Hello, Our AR dept is saving hundreds of emails as .msg on a shared network drive. These emails contain .xls attachments that we would like to batch print without having to open each file and each attachment and click print. I have some vba code from a prior thread that will work within Outlook but don't know how to get all these .msg into my inbox. Any suggestions? Thank you in advance :) Cathy You can open an *.msg file with the CreateItemFromTemplate function. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: <http://...

Access 2000 to SQL?
I want to know if you'd recommend that a novice convert back end data files to SQL database tables. I want to continue using Access 2000 as front-end. Our users are placing high demand on data tables requiring frequent compact and repairs. Any other suggestions? I kind of doubt that a novice will be able to handle that. It will take an experienced SQL Server programmer/DBA to do the job correctly. -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Denise" <anonymous@discussions.microsoft.com> wrote in ...

Re: Save xla as xls?
I have an addin which has a couple of worksheets and a code module a the basis of a new file. I would like the addin to save these 3 items as a new file but when use something like... ThisWorkbook.SaveAs Filename:="BalanceSheet.xls" FileFormat:=xlWorkbookNormal It saves the file as an xls fine but retains the property... IsAddin = True Can I set this to false when saving or does it have to be done anothe way? Rgds, Matt -- Message posted from http://www.ExcelForum.com You can do something like this: ThisWorkbook.IsAddin = False ThisWorkbook.SaveAs Filename:="BalanceSh...

'Save As' in Excel
Greetings, I would like to create an Excel file from within another file, I want it to act like this. I want to open a specific file (we will call it 'myfile') and from within 'myfile' I want to save the current file as another called 'mynewdate' when the 'Save As' is selceted from the File menu. I want the new file to use the current date as a default file name in the format of '/mmddyyyy'. So here is the scenario;open myfile, save as (diaglog opens) mmddyyyy is already in filr name box. How can I do this? Thanks -- Please reply to newsgroup so...

Saving files to memory stick
Hi, I am wanting to save a lot of individual files from a web based program to my memory stick, once I click on save they are in a Microsoft Word format - I then have to select my memory stick before I can then save. Is there a way of making my memory stick the default save location so I don't have to select it every time? Thanks Never save or write files directly to removable media. You risk ending up with corrupt files. -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "Jon" <Jon@discussions....

Draft will not save in Windows Live Mail
When I try and save an email message to my draft folder, pop-up says saved to drafts folder. However, when i look in the drafts folder it has vanished. Help would be appreciated. Nanatoo A Gmail account setup as IMAP uses the Drafts folder in Storage folders. Alt + V, Layout, Folder pane, check Show Storage folders. -- Ron Sommer MS MVP- Windows Live Mail "Nanatoo" <jeanyule@gmail.com> wrote in message news:18659E0F-8091-42F1-82B0-20201FBBF0B4@microsoft.com... > When I try and save an email message to my draft folder, pop-up says saved > to dr...