登录论坛

查看完整版本 : [MATLAB基础] Matlab字符串连接


faye135
2011-11-13, 14:52
想构造一个数据库更改语句,:
update(conna,'testFeature',{'State'},{1},sqlStatement);
其中testFeature为表名,State为字段名,sqlStatement为查询条件,语句的目的是把符合条件的State字段值变为1。

sqlStatement是通过字符串拼接产生的,已知字符串变量:filename = ‘11.txt’
用sqlStatement= ['where FeatureName = ',filename];报错,因为最后生成的结果是sqlStatement = ‘where FeatureName =11.txt’,而不是sqlStatement = ‘where FeatureName =‘11.txt’’

请问怎样能生成sqlStatement = ‘where FeatureName =‘11.txt’’呢?:)

faye135
2011-11-13, 16:13
怎么没人给我回复?
没关系,这个问题我已经解决了,通过别的字段访问数据库改值,但是希望有高人给指点一下,用字符串变量怎么做