How should I multiple insert multiple records?

static void InsertSettings(IEnumerable<Entry> settings) { using (SqlConnection oConnection = new SqlConnection(“Data Source=(local);Initial Catalog=Wip;Integrated Security=True”)) { oConnection.Open(); using (SqlTransaction oTransaction = oConnection.BeginTransaction()) { using (SqlCommand oCommand = oConnection.CreateCommand()) { oCommand.Transaction = oTransaction; oCommand.CommandType = CommandType.Text; oCommand.CommandText = “INSERT INTO [Setting] ([Key], [Value]) VALUES (@key, @value);”; oCommand.Parameters.Add(new SqlParameter(“@key”, SqlDbType.NChar)); oCommand.Parameters.Add(new SqlParameter(“@value”, SqlDbType.NChar)); try { foreach (var oSetting … Read more

MySQL – how many rows can I insert in one single INSERT statement?

You can insert infinitely large number of records using INSERT … SELECT pattern, provided you have those records, or part of, in other tables. But if you are hard-coding the values using INSERT … VALUES pattern, then there is a limit on how large/long your statement is: max_allowed_packet which limits the length of SQL statements … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)