在程序中需要用到odbc来更新dbf表的数据对于字符型的更新正常执行了,但对于数值型,更新总是有问题
下面是我的程序代码:OdbcConnection con;
con = new OdbcConnection("略...");//数据库连接正常
con.Open();
OdbcCommand updateCommand = new OdbcCommand(tempUpdateText);
updateCommand.Connection = con;
updateCommand.ExecuteNonQuery();
con.Close(); 其中 tempUpdateText字符串里的sql语句如下:
update tableA set 图元编号=2 where 图元编号=1 and 图片='D:\skylinedesktop\1219488533295.jpg' and 视频='G:\earthquake.asf'
就是想把图元编号由1改为2,图元编号字段类型为数值型,语句执行也没保任何错误,但就是没得到想要的结果,这语句有什么不对吗?
下面是我的程序代码:OdbcConnection con;
con = new OdbcConnection("略...");//数据库连接正常
con.Open();
OdbcCommand updateCommand = new OdbcCommand(tempUpdateText);
updateCommand.Connection = con;
updateCommand.ExecuteNonQuery();
con.Close(); 其中 tempUpdateText字符串里的sql语句如下:
update tableA set 图元编号=2 where 图元编号=1 and 图片='D:\skylinedesktop\1219488533295.jpg' and 视频='G:\earthquake.asf'
就是想把图元编号由1改为2,图元编号字段类型为数值型,语句执行也没保任何错误,但就是没得到想要的结果,这语句有什么不对吗?
你有没有用事务?用了事务没有commit是不行的.
如果报错的话可能你的SQL语句有问题,也有可能是你的编号有约束什么之类的.
加上中扩号再试下:update tableA set [图元编号]=2 where [图元编号]=1 and [图片]='D:\skylinedesktop\1219488533295.jpg' and [视频]='G:\earthquake.asf'