SlideShare a Scribd company logo
1 of 1
using System.Data.OleDb;
using System.Data.SqlClient;
OleDbConnection x;
OleDbCommand y;
OleDbDataReader z;
protected void Button1_Click(object sender, EventArgs e)
{
FileUpload1.SaveAs(Server.MapPath("~/File/")+FileUpload1.FileName);
x = new OleDbConnection("provider=microsoft.ace.oledb.12.0;data source="
+ Server.MapPath("~/File/") + FileUpload1.FileName + "; extended
properties=excel 12.0");
x.Open();
y = new OleDbCommand("select * from [sheet1$]", x);
z = y.ExecuteReader();
SqlConnection x1 = new SqlConnection("data source=AGILE867E8D92B;initial catalog=master;integrated security=sspi");
x1.Open();
SqlBulkCopy sb = new SqlBulkCopy(x1);
sb.DestinationTableName = "emp";
sb.WriteToServer(z);
x.Close();
x1.Close();
}
--------------------------

More Related Content

What's hot

Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheetDo something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheetBruce McPherson
 
Working with NoSQL in a SQL Database (XDevApi)
Working with NoSQL in a SQL Database (XDevApi)Working with NoSQL in a SQL Database (XDevApi)
Working with NoSQL in a SQL Database (XDevApi)Lior Altarescu
 
NoSQL in SQL - Lior Altarescu
NoSQL in SQL - Lior Altarescu NoSQL in SQL - Lior Altarescu
NoSQL in SQL - Lior Altarescu Wix Engineering
 
Javascript Arrays
Javascript ArraysJavascript Arrays
Javascript Arraysshaheenakv
 
Google cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstractionGoogle cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstractionBruce McPherson
 
MongoDB Aggregation
MongoDB Aggregation MongoDB Aggregation
MongoDB Aggregation Amit Ghosh
 
XWiki: The best wiki for developers
XWiki: The best wiki for developersXWiki: The best wiki for developers
XWiki: The best wiki for developersVincent Massol
 
Do something in 5 with gas 8-copy between databases
Do something in 5 with gas 8-copy between databasesDo something in 5 with gas 8-copy between databases
Do something in 5 with gas 8-copy between databasesBruce McPherson
 
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012Amazon Web Services
 
Bristol 2009 q1_wright_steve
Bristol 2009 q1_wright_steveBristol 2009 q1_wright_steve
Bristol 2009 q1_wright_steveObsidian Software
 
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)Sirar Salih
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDbsliimohara
 
Asynchronous programming
Asynchronous programmingAsynchronous programming
Asynchronous programmingFilip Ekberg
 
Is2215 lecture8 relational_databases
Is2215 lecture8 relational_databasesIs2215 lecture8 relational_databases
Is2215 lecture8 relational_databasesdannygriff1
 
Do something in 5 with apps scripts number 6 - fusion crossfilter
Do something in 5 with apps scripts number 6 - fusion crossfilterDo something in 5 with apps scripts number 6 - fusion crossfilter
Do something in 5 with apps scripts number 6 - fusion crossfilterBruce McPherson
 
No More Deadlocks; Asynchronous Programming in .NET
No More Deadlocks; Asynchronous Programming in .NETNo More Deadlocks; Asynchronous Programming in .NET
No More Deadlocks; Asynchronous Programming in .NETFilip Ekberg
 
Introduction tomongodb
Introduction tomongodbIntroduction tomongodb
Introduction tomongodbLee Theobald
 

What's hot (20)

Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheetDo something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
 
Working with NoSQL in a SQL Database (XDevApi)
Working with NoSQL in a SQL Database (XDevApi)Working with NoSQL in a SQL Database (XDevApi)
Working with NoSQL in a SQL Database (XDevApi)
 
NoSQL in SQL - Lior Altarescu
NoSQL in SQL - Lior Altarescu NoSQL in SQL - Lior Altarescu
NoSQL in SQL - Lior Altarescu
 
Javascript Arrays
Javascript ArraysJavascript Arrays
Javascript Arrays
 
Google cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstractionGoogle cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstraction
 
MongoDB Aggregation
MongoDB Aggregation MongoDB Aggregation
MongoDB Aggregation
 
XWiki: The best wiki for developers
XWiki: The best wiki for developersXWiki: The best wiki for developers
XWiki: The best wiki for developers
 
Do something in 5 with gas 8-copy between databases
Do something in 5 with gas 8-copy between databasesDo something in 5 with gas 8-copy between databases
Do something in 5 with gas 8-copy between databases
 
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
MBL301 Data Persistence to Amazon Dynamodb for Mobile Apps - AWS re: Invent 2012
 
Bristol 2009 q1_wright_steve
Bristol 2009 q1_wright_steveBristol 2009 q1_wright_steve
Bristol 2009 q1_wright_steve
 
Elastic Search
Elastic SearchElastic Search
Elastic Search
 
Quanlycanbo
QuanlycanboQuanlycanbo
Quanlycanbo
 
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDb
 
Asynchronous programming
Asynchronous programmingAsynchronous programming
Asynchronous programming
 
Is2215 lecture8 relational_databases
Is2215 lecture8 relational_databasesIs2215 lecture8 relational_databases
Is2215 lecture8 relational_databases
 
Do something in 5 with apps scripts number 6 - fusion crossfilter
Do something in 5 with apps scripts number 6 - fusion crossfilterDo something in 5 with apps scripts number 6 - fusion crossfilter
Do something in 5 with apps scripts number 6 - fusion crossfilter
 
No More Deadlocks; Asynchronous Programming in .NET
No More Deadlocks; Asynchronous Programming in .NETNo More Deadlocks; Asynchronous Programming in .NET
No More Deadlocks; Asynchronous Programming in .NET
 
Scala on Your Phone
Scala on Your PhoneScala on Your Phone
Scala on Your Phone
 
Introduction tomongodb
Introduction tomongodbIntroduction tomongodb
Introduction tomongodb
 

Viewers also liked

Fitxa del curs
Fitxa del cursFitxa del curs
Fitxa del cursadegiron67
 
Ivanovo Municipality Festivals
Ivanovo Municipality FestivalsIvanovo Municipality Festivals
Ivanovo Municipality FestivalsIvan Ivanov
 
DIL PREV 2081/2012 AUTO Juzgado 1ª Instancia e Instrucción Nº5 Estepona (16 d...
DIL PREV 2081/2012 AUTO Juzgado 1ª Instancia e Instrucción Nº5 Estepona (16 d...DIL PREV 2081/2012 AUTO Juzgado 1ª Instancia e Instrucción Nº5 Estepona (16 d...
DIL PREV 2081/2012 AUTO Juzgado 1ª Instancia e Instrucción Nº5 Estepona (16 d...TheDailyCorruption
 
Hyperliaisons amoureuses
Hyperliaisons amoureusesHyperliaisons amoureuses
Hyperliaisons amoureusescamillelacassie
 
Inp corporate presentation dec_2013
Inp corporate presentation dec_2013Inp corporate presentation dec_2013
Inp corporate presentation dec_2013inputcapital
 
московский завод композитных материалов презентация продукции
московский завод композитных материалов презентация продукциимосковский завод композитных материалов презентация продукции
московский завод композитных материалов презентация продукцииEvgeny Arhipov
 
Legal Regulatory and Contractual Policy Frame Work in Public Private Partners...
Legal Regulatory and Contractual Policy Frame Work in Public Private Partners...Legal Regulatory and Contractual Policy Frame Work in Public Private Partners...
Legal Regulatory and Contractual Policy Frame Work in Public Private Partners...Divyanshu Dayal
 
La comunicación audiovisual
La comunicación audiovisualLa comunicación audiovisual
La comunicación audiovisualevelyn67
 
INDIA BUSINESS CULTURE AND ETIQUETTE GUIDE
INDIA BUSINESS CULTURE AND ETIQUETTE GUIDEINDIA BUSINESS CULTURE AND ETIQUETTE GUIDE
INDIA BUSINESS CULTURE AND ETIQUETTE GUIDEGlobal Negotiator
 

Viewers also liked (20)

Audience profile
Audience profileAudience profile
Audience profile
 
Fitxa del curs
Fitxa del cursFitxa del curs
Fitxa del curs
 
My Game
My GameMy Game
My Game
 
Web Designing Services
Web Designing ServicesWeb Designing Services
Web Designing Services
 
Ivanovo Municipality Festivals
Ivanovo Municipality FestivalsIvanovo Municipality Festivals
Ivanovo Municipality Festivals
 
DIL PREV 2081/2012 AUTO Juzgado 1ª Instancia e Instrucción Nº5 Estepona (16 d...
DIL PREV 2081/2012 AUTO Juzgado 1ª Instancia e Instrucción Nº5 Estepona (16 d...DIL PREV 2081/2012 AUTO Juzgado 1ª Instancia e Instrucción Nº5 Estepona (16 d...
DIL PREV 2081/2012 AUTO Juzgado 1ª Instancia e Instrucción Nº5 Estepona (16 d...
 
Amy limoge korea
Amy limoge koreaAmy limoge korea
Amy limoge korea
 
iMade Workshop 3 - Komosie
iMade Workshop 3 - KomosieiMade Workshop 3 - Komosie
iMade Workshop 3 - Komosie
 
Released pitch
Released pitchReleased pitch
Released pitch
 
Origami
OrigamiOrigami
Origami
 
Hyperliaisons amoureuses
Hyperliaisons amoureusesHyperliaisons amoureuses
Hyperliaisons amoureuses
 
Game lynch Kyiv 2013
Game lynch Kyiv 2013Game lynch Kyiv 2013
Game lynch Kyiv 2013
 
Inp corporate presentation dec_2013
Inp corporate presentation dec_2013Inp corporate presentation dec_2013
Inp corporate presentation dec_2013
 
московский завод композитных материалов презентация продукции
московский завод композитных материалов презентация продукциимосковский завод композитных материалов презентация продукции
московский завод композитных материалов презентация продукции
 
Costume
CostumeCostume
Costume
 
Legal Regulatory and Contractual Policy Frame Work in Public Private Partners...
Legal Regulatory and Contractual Policy Frame Work in Public Private Partners...Legal Regulatory and Contractual Policy Frame Work in Public Private Partners...
Legal Regulatory and Contractual Policy Frame Work in Public Private Partners...
 
Airboat
AirboatAirboat
Airboat
 
La comunicación audiovisual
La comunicación audiovisualLa comunicación audiovisual
La comunicación audiovisual
 
iMade Workshop 3 - Sirris
iMade Workshop 3 - SirrisiMade Workshop 3 - Sirris
iMade Workshop 3 - Sirris
 
INDIA BUSINESS CULTURE AND ETIQUETTE GUIDE
INDIA BUSINESS CULTURE AND ETIQUETTE GUIDEINDIA BUSINESS CULTURE AND ETIQUETTE GUIDE
INDIA BUSINESS CULTURE AND ETIQUETTE GUIDE
 

Bulk copy

  • 1. using System.Data.OleDb; using System.Data.SqlClient; OleDbConnection x; OleDbCommand y; OleDbDataReader z; protected void Button1_Click(object sender, EventArgs e) { FileUpload1.SaveAs(Server.MapPath("~/File/")+FileUpload1.FileName); x = new OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=" + Server.MapPath("~/File/") + FileUpload1.FileName + "; extended properties=excel 12.0"); x.Open(); y = new OleDbCommand("select * from [sheet1$]", x); z = y.ExecuteReader(); SqlConnection x1 = new SqlConnection("data source=AGILE867E8D92B;initial catalog=master;integrated security=sspi"); x1.Open(); SqlBulkCopy sb = new SqlBulkCopy(x1); sb.DestinationTableName = "emp"; sb.WriteToServer(z); x.Close(); x1.Close(); } --------------------------