C#Update + with" label"

时间:2017-07-09 21:21:48

标签: c# access

我想改变这个

string query = "Update tbPegawai set Total_Gaji = Total_Gaji +   where Kode_Pegawai = " + textBoxKDPegawai.Text + "";

到此:

string query = "Update tbPegawai set Total_Gaji = Total_Gaji + "**Label**"  where Kode_Pegawai = " + textBoxKDPegawai.Text + "";

我该怎么做?

2 个答案:

答案 0 :(得分:0)

string query =“更新tbPegawai设置Total_Gaji = Total_Gaji + \”Label \“其中Kode_Pegawai =”+ textBoxKDPegawai.Text +“”;

string query = @“更新tbPegawai设置Total_Gaji = Total_Gaji +”Label“其中Kode_Pegawai =”+ textBoxKDPegawai.Text +“”;

答案 1 :(得分:0)

我认为你正在寻找这个:

string query = string.Format(@"Update tbPegawai set Total_Gaji = Total_Gaji + ""{0}""  where Kode_Pegawai = ""{1}""",Label.Text,textBoxKDPegawai.Text);