Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use OLEDB, as for an example you can do somoething like follwing for CSV and quite similar for Excel</p> <pre><code>//Target Database: CSV string strBasePath = @"C:\Database"; string strFilename = @"NewCSV.csv"; string CSVConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source='" + strBasePath + @"';Extended Properties='text; HDR=Yes;FMT=Delimited';"; </code></pre> <p>and then :</p> <pre><code>using (OleDbConnection CSVConnection = new OleDbConnection(CSVConnectionString)) { try { CSVConnection.Open(); string strInsertCommand = @"INSERT INTO " + strFilename + @" (CustomerID, CustomerName, Country) VALUES (@custid, @name, @country)"; OleDbCommand InsertCommanmd = CSVConnection.CreateCommand(); InsertCommanmd.CommandText = strInsertCommand; foreach ( var item in List&lt;T&gt; ) { InsertCommanmd.Parameters.Clear(); InsertCommanmd.Parameters.AddWithValue("@custid", item.prop1); InsertCommanmd.Parameters.AddWithValue("@name", item.prop2); InsertCommanmd.Parameters.AddWithValue("@country", item.prop3); InsertCommanmd.ExecuteNonQuery(); } } finally { if (!CSVConnection.State.Equals(ConnectionState.Closed)) CSVConnection.Close(); } } </code></pre> <p>For getting headstart in Excel :</p> <pre><code>string ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Path\Book81.xlsx;Extended Properties=Excel 8.0;"; OleDbConnection ExcelConnection = new OleDbConnection(ConnectionString); ExcelConnection.Open(); string update = "UPDATE [Sheet1$] SET Name='Smith Jones' where name='Smith'"; OleDbCommand UpdateCommand = new OleDbCommand(update, ExcelConnection); UpdateCommand.ExecuteNonQuery(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload