1 if (AccessCon.ExecuteSql(sql = "select * from salesData where index ='" + man.Index + "'") > 0)2 {3 retValue = AccessCon.ExecuteSql(sql = "update salesData set sellingPrize='" + man.SellingPrize + "' where index='" + man.Index + "'");4 Console.WriteLine(sql);5 }6 else
7 {8 retValue = AccessCon.ExecuteSql(sql = "insert into salesData values ('" + man.Index + "','" + man.SellingPrize + "')");9 Console.WriteLine(sql);10 }11
12 return retValue;
本来想通过select * from salesData where index =' man.Index '执行后的返回值是否大于0判断表中是否已有数据
因为msdn中说返回受影响的行数:
Executes a Transact-SQL statement against the connection and returns the number of rows affected.
但是却没看到备注里说
For UPDATE, INSERT, and DELETE statements, the retur