473,763 Members | 6,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple XML Import into SQL 2005

1 New Member
I am a total nube with XML and am struggling with a simple XML import into SQL 2005. Lots of boring code to follow: (In short though, my basic question is this: What in the world are my tables supposed to look like? I have a Database named "Cube", a Table named "Cube" with 2 columns, Currency and Rate, respectively)

If I can see how the table schema should be, that should be half, if not all, the battle.

The error thrown is: System.Runtime. InteropServices .COMexception: "Schema: Relationship expected n 'Cube'."

Thank you in advance



The XML File:
<?xml version="1.0" encoding="UTF-8" ?>

- <gesmes:Envelop e xmlns:gesmes="h ttp://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
<gesmes:subject >Reference rates</gesmes:subject>
- <gesmes:Sende r>
<gesmes:name>Eu ropean Central Bank</gesmes:name>
</gesmes:Sender>
- <Cube>
- <Cube time="2007-11-26">
<Cube currency="USD" rate="1.4845" />
<Cube currency="JPY" rate="160.96" />
<Cube currency="BGN" rate="1.9558" />
...
<Cube currency="ZAR" rate="10.1240" />
</Cube>
</Cube>
</gesmes:Envelope >
The Schema File:
<?xml version="1.0"?>
<xs:schema attributeFormDe fault="unqualif ied" elementFormDefa ult="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Cube">
<xs:complexType >
<xs:sequence>
<xs:element minOccurs="0" name="Cube">
<xs:complexType >
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbo unded" name="Cube">
<xs:complexType >
<xs:attribute name="currency" type="xs:string " use="optional" />
<xs:attribute name="rate" type="xs:decima l" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="time" type="xs:date" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
My C# Code that is supposed to dump the XML data into my SQL Server 2005 database
string connStr;
connStr = "provider=SQLNC LI;Data Source=.\\SQLEX PRESS;Initial Catalog=Cube;In tegrated Security=SSPI";
SQLXMLBULKLOADL ib.SQLXMLBulkLo ad objBL = new SQLXMLBULKLOADL ib.SQLXMLBulkLo ad();
objBL.Connectio nString = connStr;
objBL.BulkLoad = true;
objBL.XMLFragme nt = true;
objBL.KeepIdent ity = false;
objBL.ErrorLogF ile = "C:\\BulkLoadEr rors.xml";
objBL.Execute(" C:\\DailyExchan geRates\\Schema .XSD", "C:\\DailyExcha ngeRates\\eurof xref-daily.xml");
Nov 27 '07 #1
0 1306

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2697
by: jean.rossier | last post by:
Hello All, I am facing a problem while importing pylab library(in a .py program file) via web browser however the same program works when I execute it from the command prompt. my configuration : Fedora Core 3 Apache 2.0
5
2478
by: Steve Holden | last post by:
This is even stranger: it makes it if I import the module a second time: import dbimp as dbimp import sys if __name__ == "__main__": dbimp.install() #k = sys.modules.keys() #k.sort() #for kk in k:
38
3537
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser = serial.Serial()
7
318
by: LeROY | last post by:
I need to output some related data tables as XML. I have my data adapters and my dataset with the relations defined. It is certainly simple enough to use the dataset.WriteXML function. However, this writes the data such that each DataTable in the dataset is written one after the other. This is not what I need. I do not need to be able to load this back into a dataset at a later time. The XML file and schema I generate will be used to...
4
2058
by: Jari Aalto | last post by:
Please suggest comments how can I make this script to work from bash. Also how can I skip better the argument from command line without hte extra variable i? #!/bin/bash function compile () { python -c ' import os, sys, py_compile;
79
5281
by: pinkfloydhomer | last post by:
I want to scan a file byte for byte for occurences of the the four byte pattern 0x00000100. I've tried with this: # start import sys numChars = 0 startCode = 0 count = 0
1
9835
by: Chicagoboy27 | last post by:
Is there a way to import multiple csv files from a directory into sql 2005? The situation I have right now is that I have a folder with multiple csv files that i need to import into sql 2005. I can do it with the import wizard but it takes to long. The files will be updated monthly. The first row in the files contains all the header information which may change monthy. What I am looking to do is import all of these csv into tables. One...
0
1228
by: 123bargains | last post by:
Hello, I have a question on importing a database from MSSQL 2000 to MSSQL 2005. I hope someone on here can help me answer it. I am trying to import a database from MSSQL 2000 to 2005. But, when I tried to import it, the data and tables came in just fine, but the properties such as Identity Values, Column Defaults, Indexes did not import. Also the stored procedures did not import. This causes a problem as I have a lot of tables and I have...
1
1593
by: Victor | last post by:
Hi guys I have a small question abou the vs2005's text editor. in my text editor, any space or tabs become little dot. i forget what shortcut i pressed.It looks not right to me at all. Can anyone knows how to turn it back? I am using vs2005+resharp3.0 Cheers Victor
0
9564
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.