.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Asad Ali
Fauzul Azmi
Post New Web Links

xml import to database

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
 

Hello. I have XML document I use for backups..

I am using this code for importing XML to database:

protected void uvoziPodatkeXML(string backup, int tabela, string destinacijaTabela)
        {
            DataSet reportData = new DataSet();

            FileStream filestream = File.OpenRead(lblPotIzvozi.Text + txtIme.Text + backup);
            BufferedStream buffered = new BufferedStream(filestream);
            reportData.ReadXml(buffered);

            //reportData.ReadXml(lblPotIzvozi.Text + txtIme.Text + backup);



            SqlConnection povezava = new SqlConnection(Convert.ToString(Session["cs"]));
            SqlBulkCopy sbc = new SqlBulkCopy(Convert.ToString(Session["cs"]), SqlBulkCopyOptions.KeepIdentity);
            povezava.Open();
            sbc.DestinationTableName = destinacijaTabela;
            sbc.WriteToServer(reportData.Tables[tabela]);
            sbc.Close();

            povezava.Close();
        }


But there is a problem when XML file is very large, larger than 50MB, it lasts forever to import to database.. I was searching over google, and saw that datasets are terrible slow for this operation.. I found some other methodes for use, but don't know there are no examples, that could help me.

Did someone work on this before?

thanks, yevgeni


View Complete Post


More Related Resource Links

how to import a database from sql 2008 r2 to sql 2008 ( from 10.50.1600 to 10.0.2531.0)

  
Hi I wolud like to import a database from sql 2008 r2 to sql 2008. I have got an error: This version is incompatible with that server. Microsoft SQL Server Management Studio      10.0.2531.0 Microsoft Analysis Services-Clienttools      10.0.1600.22 Microsoft Data Access Components (MDAC)      6.1.7600.16385 Microsoft MSXML      3.0 6.0 Microsoft Internet Explorer      8.0.7600.16385 Microsoft .NET Framework      2.0.50727.4927 Betriebssystem      6.1.7600 Thanks in advance Sebatian

import a database from sql 2008 r2 to sql 2008.

  
Hi I wolud like to import a database from sql 2008 r2 to sql 2008. I have got an error: This version is incompatible with that server. Microsoft SQL Server Management Studio      10.0.2531.0 Microsoft Analysis Services-Clienttools      10.0.1600.22 Microsoft Data Access Components (MDAC)      6.1.7600.16385 Microsoft MSXML      3.0 6.0 Microsoft Internet Explorer      8.0.7600.16385 Microsoft .NET Framework      2.0.50727.4927 Betriebssystem      6.1.7600 Thanks in advance Sebatian

Unable to see Active Directory Groups in the User Profile Database after Profile Import

  
SharePoint Server 2010 Enterprise RTM. W2K8R2 w/multi-server setup: AD/DNS SQL 2008 WFE APP Claims Mode Web App only using Windows Integrated Auth So, this was never a problem in 2007, and I didn't even realize it was a problem in 2010 until I started to build a solution that utilized my blog article: InfoPath - User Roles in Browser-Enabled Forms Using AD Groups.  I went to utilize the same web method of the same web service, but I noticed that no data was showing up at all.  Typically, the GetUserMembership/GetCommonMembership methods return the specified user's memberships: AD Security Groups, AD Distribution Lists, and SharePoint Sites (not SharePoint Groups, though). My user profile sync is working.  All AD users are pulled in with the proper profile data. "Users and Groups" is selected in the Synchronization Entities section of my Sync Settings. Security groups are working for permissions and audience targeting.  Confirmed my users are affected properly by the use of Security Groups. My query to the GetUserMemberships web method (and GetCommonMemberships) is running (not failing), but it's not returning anything even though my user is in some Security Groups and has explicit membership to multiple sites. The GetUserProfileByName method of the same UserProfileService.asmx web service returns all the regular profile data

is it possible to import data into a replicated database

  

I have a 2005 database set up Ok for Merge replicataion and I need to add data from an Acess 97 database I have been using the wizard to import the tables to new tables then I have a script which appends the tables sometimes making small changes this is fine if the database is not replicable but will not work if it is.  I do need to keep all identiy fields
Some of these tables only have a couple of rows and their 'range' seems to be within the values in the table properties

I get error
The insert failed. It conflicted with an identity range check constraint in database 'My_MPC', replicated table 'dbo.TblLiqItems', column 'LiqId'. If the identity column is automatically managed by replication, update the range as follows: for the Publisher, execute sp_adjustpublisheridentityrange; for the Subscriber, run the Distribution Agent or the Merge Agent.


jnc

import text to database

  

Hi,

I have a text file that looks like this:
Chapter 1
Line 1: some text here some text here
Line 2: some text here some text here
Line 3: some text here some text here

Chapter 2
Line 1: some text here some text here
Line 2: some text here some text here
Line 3: some text here some text here

I want to import this into a database so that the table will look something like this:
Chapter, Line, Text
1,1,some text here some text here
1,2,some text here some text here
1,3,some text here some text here
2,1,some text here some text here
2,2,some text here some text here
I guess I need to wrote some custom C#/VB code to get this done, is this correct or can I use SSIS with / without the custome code.

TIA

eddiec :-)


Import multiple xml files(sharepoint webservices out put) to sql database using ssis

  

Hi,

I am importing xml file in to sql server database i was able to do this task for single xml file in to sql database using ssis( i am using dataflow task, xml source, data conversion, oledb destination creating a ssis package).

Now i am having 3 xml files, need to store in different tables in sql server database can someone explain how i can import multiple xml files in to different tables in sql.can we create a xsd for each xml file while importing.


Complete Database Export/Import

  

I have a question I am hoping someone can answer in a nutshell.  I work at a small company that has a 75GB SQL Server 2000 DB.  Data is written to and deleted from many of the 500 tables it contains.  Some of the largest tables contain over 21 million rows.  It is believed that this databse has never had any maintanence performed, such as index defrags or compaction of any sort.  I will admit I am more of a systems engineer and not a DBA, but my questions are as follows:

My supervisor believes that if we export/import the entire database (or copy and re-write?), then the data, and indexes will be re-written in a contiguous format and this will speed up read/write access.

I believe, that even if there is a way to export/import the data, or to recreate the DB schema and then basically re-create the DB, that this will not impove the performance or re-organize the indexes.  I suggested that we use DBCC DBREINDEX as a starting point since it has never had best practices implemented.

Any suggestions?

Thanks,

Michael


How to import existing database into Webmatrix?

  

I am planning to use Webmatrix as a testing arena for creating and completing the preparation of a website before publishing it. Working with websites on local computer should be much faster than doing that on an online server.

That is why I downloaded a database that I have already created on my online host account, and wanted to import it into webmatrix to continue building my new website using Webmatrix. Here, I did not know how to imort the DB I downloaded from my host, into webmatrix. There is seemingly no way to do that, or to import tables into an existing DB on webmatrix. 

Is that not possible? 

2- I tried to create a new DB on webmatrix which is a part of installing Wordbress on WM (new site from web gallery --> Wordpress), but I get this error :

The database 'xxxx' could not be created. ---> MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:3306


I have installed PHP 5.2 and Mysql on Webmatrix. 


Why does this happen?


is it possible to import the content and structure of an xml file into a database

  
directly creating the table structure and name as it was in access 2007 ???
claudio cannella

Import xls file into sql server database table in asp.net

  

I have one xls file which has 1.98 lacs rows. Whenever I try to import it in sql database table then I am getting following error to open OLE db connection.

External table is not in the expected format.


My code:

string con = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("TowerWorkOrders20110316.xls") + ";Extended Properties=\"Excel 12.0\"";       

 //string con = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("TowerWorkOrders20110317.xls") + ";Extended Properties=Excel 8.0";        

OleDbConnection connection = new 
OleDbConnection(con);        

OleDbDataReader reader;        
connection.Open();       
 OleDbCommand command = new OleDbCommand("SELECT * FROM [Sheet1$]", connection);        
reader = command.ExecuteReader();.................



How to import existing database into Webmatrix?

  

I am planning to use Webmatrix as a testing arena for creating and completing the preparation of a website before publishing it. Working with websites on local computer should be much faster than doing that on an online server.

That is why I downloaded a database that I have already created on my online host account, and wanted to import it into webmatrix to continue building my new website using Webmatrix. Here, I did not know how to imort the DB I downloaded from my host, into webmatrix. There is seemingly no way to do that, or to import tables into an existing DB on webmatrix. 

Is that not possible? 

2- I tried to create a new DB on webmatrix which is a part of installing Wordbress on WM (new site from web gallery --> Wordpress), but I get this error :

The database 'xxxx' could not be created. ---> MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:3306


I have installed PHP 5.2 and Mysql on Webmatrix. 


Why does this happen?


Multiple database support with Entity Framework

  
One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

  
If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

  
If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

  
We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Adding Rows in GridView without using a Database

  
This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back.

Adding Multiple Columns and Rows in GridView without using a Database

  
This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend