for example:
StringBuilder query = new StringBuilder();
foreach (KeyValuePair<string, string> key in list)
{
string name = key.Key;
string emails = key.Value;
query.AppendFormat("insert into contacts(name, emails) values('{0}', '{1}');", name, emails);
}
string queries = query.ToString(); //how to run it?
it is possible?
Your best option is to begin a transaction before the loop, execute each statement rather than adding it to stringbuilder, and commit after the loop (or every n number of records).
Also, you should use a parameterized command, something along the lines of:
Alternatively, you can use the SQL Compact Bulk Insert Library from codeplex. I believe that this uses a TableDirect SqlCeCommand on top of a SqlCeResultSet, which should bypass the query processor and be about as fast as you can get.