注册 登录
编程论坛 C# 论坛

错误 3 运算符“+”无法应用于“string”类型的操作数

V小v 发布于 2016-02-13 16:51, 3732 次点击
int index_1 = listBox1.Text.IndexOf(":");//获取 :所在位置
                        string id_1 = listBox1.Text.Substring(0, index_1);
                        //int ic = Int32.Parse(id_1);
                        int index = comboBox1.Text.IndexOf("-->");//获取字符串中-->所在位置获取分类的id
                        string id = comboBox1.Text.Substring(0, index);//只获取-->之前的字符
                        string sql = "UPDATE linshiyizhu SET 住院号=" + textBox1.Text + ",姓名='" + textBox2.Text + "',性别='" + textBox3.Text + "',年龄=" + textBox4.Text + ",科室='" + textBox5.Text + "','药名='" + textBox7.Text + "',数量=" + textBox8.Text + ",每次用量=" + textBox10.Text + ",频次='" + textBox11.Text + "',用法='" + textBox9.Text + "',备注='" + textBox12.Text + "',cid=" + textBox6.Text + " WHERE 住院号" = +id_1;
1 回复
#2
qq10235692232016-02-14 02:21
把'='写里面。
" WHERE 住院号=" + id_1;
1