我了解到,在 VS 代码中,您可以通过组合键“ !+ tab ”自动创建程序的基本结构,但由于某种原因,这种组合对我不起作用,如果我只写“ !+ tab ”那么 tab会向右缩进,仅此而已,如果我写“ <! + tab ”,那么只会出现“ <!DOCTYPE html ”这一行,没有其他内容,这是为什么呢?请告诉我
主页
/
user-479745
xto's questions
我通过单击按钮将更改保存在数据库表中,这是代码本身:
else if (comboBox1.SelectedItem == "Элек")
{
label3.Text = "Электричество";
string script = "SELECT id, name, Mx_pw_VT, Pr_pw_VT, elec_kVT_hr, Print_time_fact, YZV_power_VT FROM elec;";
mycon = new MySqlConnection(connect);
mycon.Open();
MySqlDataAdapter ms_data = new MySqlDataAdapter(script, connect);
var cb = new MySqlCommandBuilder(ms_data);
cb.GetInsertCommand();
ms_data.Update(dataGridView1.DataSource as DataTable);
ms_data.InsertCommand = cb.GetInsertCommand();
ms_data.InsertCommand.CommandText += "; select * from elec where id = last_insert_id();";
ms_data.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
}
但由于某种原因,它给了我一个错误«Нарушение параллелизма: UpdateCommand затронула 0 из ожидаемых 1 записей.»
。我对另一个表有相同的代码块并且它可以工作,这个表中发生了变化,块本身:
else if (comboBox1.SelectedItem == "Рбт")
{
label3.Text = "Рбт";
string script = "SELECT id, name, Model_preparation_R_Hr, Time_for_preparation_hr, Time_for_post_processing_hr, YZV_work FROM rbt;";
mycon = new MySqlConnection(connect);
mycon.Open();
MySqlDataAdapter ms_data = new MySqlDataAdapter(script, connect);
var cb = new MySqlCommandBuilder(ms_data);
cb.GetInsertCommand();
ms_data.Update(dataGridView1.DataSource as DataTable);
ms_data.InsertCommand = cb.GetInsertCommand();
ms_data.InsertCommand.CommandText += "; select * from rbt where id = last_insert_id();";
ms_data.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
}
怎么了?请告诉我