You're essentially asking two separate questions here, one about inserting data without first selecting from the target table and another about keeping your persistence code database agnostic.
It's relatively easy to manually build up a data table in memory and persist it with the help of a DataAdapter and a DbCommandBuilder. The data adapter is used to synchronize the data table into the database and the command builder is used by the data adapter to automatically generate insert (and update) statements based on the select command provided.
So long as you don't need to run any complex SQL queries it should be fairly easy to keep your code database agnostic using a DbProviderFactory. It essentially hides the ADO.net provider implementation from you so that you code against the underlying interfaces in a generic way.
The following example should illustrate the above two concepts.
public static void Main()
{
var providerName = "System.Data.OleDb";
var connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=output.mdb";
var table = new DataTable {
Columns = {
new DataColumn("ID", typeof (int)),
new DataColumn("Name", typeof (string)) },
Rows = {
new object[] {1, "One"},
new object[] {2, "Two"} }
};
SaveData(providerName, connectionString, table);
}
private static void SaveData(string providerName,
string connectionString,
DataTable table)
{
var factory = DbProviderFactories.GetFactory(providerName);
var connection = factory.CreateConnection();
connection.ConnectionString = connectionString;
var command= factory.CreateCommand();
command.Connection = connection;
command.CommandText = "select ID, Name from Person";
var adapter = factory.CreateDataAdapter();
adapter.SelectCommand = command;
var builder = factory.CreateCommandBuilder();
builder.DataAdapter = adapter;
adapter.Update(table);
}
This solution only deals with persistence to databases. For exporting to Excel you can use the Jet OleDb provider (more info here) and for XML you can use XmlSerializer.