帮忙看看SQL的小问题
string city = this.txtCity.Text.ToString();
"insert into Infodepartment(城市名称) values(此处我想用city的值,我该怎么写?)) "
谢谢!
------解决方案--------------------string strSQL = "insert into Infodepartment(城市名称) values( ' + city + " ' ";
------解决方案--------------------insert into Infodepartment(城市名称) values( ' "+city+ " ')) "
------解决方案--------------------那就把括号加上
string strSQL = "insert into Infodepartment(城市名称) values( ' + city + " ') ";
------解决方案--------------------insert into Infodepartment(城市名称) values( ' "+city+ " ')
------解决方案--------------------string strSQL = "insert into Infodepartment(城市名称) values( ' " + city + " ') ";
to
amandag(高歌)
你的少了一个分号,一个括号...
------解决方案--------------------string strSQL = "insert into Infodepartment(城市名称) values( ' + city + " ') ";
少个双引号