Carga Masiva de datos .txt con C#将SQL Server Web

时间:2019-03-18 05:17:39

标签: c# sql-server web

我看到带有C#Web的海量数据插入,并且多余的数据是EXCEL,我想知道.txt的情况。

在Web C#中会如何?

private void button1_Click(object sender, EventArgs e)
{
        string conexion = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=C:\\importar\\Excel_DB.xlsx;Extended Properties=\"Excel 8.0;HDR=Yes\"";
        OleDbConnection origen = default(OleDbConnection);
        origen = new OleDbConnection(conexion);

        OleDbCommand seleccion = default(OleDbCommand);
        seleccion = new OleDbCommand("Select * From [Hoja1$]", origen);

        OleDbDataAdapter adaptador = new OleDbDataAdapter();
        adaptador.SelectCommand = seleccion;
        DataSet ds = new DataSet();
        adaptador.Fill(ds);
        dataGridView1.DataSource = ds.Tables[0];
        origen.Close();
}

0 个答案:

没有答案