VBAHole22 Posted June 9, 2005 Posted June 9, 2005 Someone sends me an xml file in a set format. I want to take that and get all of the records into a blank SQL Server table. I can build the table first because I know the fields. What is the fastest way to get this accomplished in C#? Quote Wanna-Be C# Superstar
IngisKahn Posted June 9, 2005 Posted June 9, 2005 C'mon dude, you've been here long enough. There's a section for XML/Database. :p Quote "Who is John Galt?"
VBAHole22 Posted June 9, 2005 Author Posted June 9, 2005 Haven't had much luck getting responses there and this seems like something that is trivial and can easily be accomplished in .NET. Yet after an hour of Googling I have only come up with SQL stored procedures to get it done. I'm not really sure what defines a 'General' question and I didn't realize these forums were so well policed. I'll try not to step out of line again. Quote Wanna-Be C# Superstar
VBAHole22 Posted June 9, 2005 Author Posted June 9, 2005 Incidentally, the term xml cannot be used to search these forums. I realize that small words like 'the' and 'and' don't contribute much to a search query but isn't something like 'xml' distinctive enough that users could be allowed to search on it? Much like a search for 'awk' or 'rpc'. Quote Wanna-Be C# Superstar
Administrators PlausiblyDamp Posted June 9, 2005 Administrators Posted June 9, 2005 Could you not load the xml into a typed dataset and use that to update the database? Alternatively you could load the file into a XmlDocument and loop over it's contents, or even use a XmlReader to read through the file and update the db manually Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
VBAHole22 Posted June 10, 2005 Author Posted June 10, 2005 What I wound up doing was just that. I looped over the xml and manually created an insert statement to put the records in. It's not pretty. I'm testing with 5 records. Go time will be 500,000 records. The dataset.update method is, from my exploration, something that recognizes changes that you have made to a dataset since you call a Fill on it. I'm filling it from the xml and not making any changes, so MS has over-engineered that bit for me. Quote Wanna-Be C# Superstar
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.