我写了以下查询。 br_name应该添加到品牌表的br_name中,但是br_name在数据库中获取空白字段 同时,其他查询也可以正常工作。
我尝试了以下无效的代码
protected void Button1_Click(object sender, EventArgs e)
{
con.Open();
MySqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO brand_sector (bs_name,v_name) VALUES ('" + TextBox6.Text + "','" + TextBox7.Text + "')";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO brand(bs_id) SELECT brand_sector.bs_id FROM brand_sector WHERE brand_sector.bs_name = '" + TextBox6.Text + "' AND brand_sector.v_name = '" + TextBox7.Text + "' ";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO brand (br_name) VALUES ('" + TextBox5.Text + "')";
cmd.ExecuteNonQuery();
con.Close();
}
我希望在品牌表的br_name中插入br_name