The problem with entering data through insert into select is the next piece of code

foreach (XElement anElement in xdoc.Element("ЗАКАЗЫ").Elements("Заказ")) { XElement dateElemet = anElement.Element("ДатаЗаказа"); XElement id_uniElement = anElement.Element("НомерЗаказа"); XElement nameElement = anElement.Element("ФИО"); XElement ageElement = anElement.Element("Возраст"); XElement maleElement = anElement.Element("Пол"); XElement pregElement = anElement.Element("СрокОт"); XElement codeElement = anElement.Element("Код"); XElement localElement = anElement.Element("Примечание"); XElement bioElement = anElement.Element("Биоматериал"); XElement id_tubeElement = anElement.Element("НомерИсследования"); string date = dateElemet.Value; string id_uni = id_uniElement.Value; string pat_name = nameElement.Value; string age = ageElement.Value; string code_uni = codeElement.Value; string id_tube = id_tubeElement.Value; id_tube = id_tube = id_tube.Remove(0, 2);//обрезаем 25 в номере пробирки string validate = "g"; string biomat = bioElement.Value; if (localElement == null) { if (maleElement == null) { OleDbCommand command = new OleDbCommand(); command.Parameters.AddWithValue("id_uni", id_uni); command.Parameters.AddWithValue("id_tube", id_tube); command.Parameters.AddWithValue("biomat", biomat); command.Parameters.AddWithValue("pat_name", pat_name); command.Parameters.AddWithValue("age", age); command.Parameters.AddWithValue("validate", validate); command.Parameters.AddWithValue("code_uni", code_uni); command.Parameters.AddWithValue("date", date); command.Connection = con; con.Open(); command.CommandText = "insert into result (id_uni,date_in,code_uni,id_tube,pat_name,age,validate_result,biomat,san_numb) select @id_uni,@date_in,@code_uni,@id_tube,@pat_name,@age,@validate_result,@biomat,san_numb from san_vac where id_uni='1990'"; command.ExecuteNonQuery(); con.Close(); } 

however, when executing the code in the result table, the data is placed in the wrong fields. In which direction to look? Maybe there is some kind of "underwater stone"?

Closed due to the fact that it was off topic by aleksandr barakin , cheops , user194374, Bald , Denis Jul 13 '16 at 6:06 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - aleksandr barakin, cheops, Community Spirit, Bald, Denis
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    In general, as it turned out during the comparison of insert results in the table - the structure that is transferred to the table was taken not from insert but from the sequence, adding parameters. Why do not I know, I will look for information.